Skip to content

Commit

Permalink
fix upload return on local client
Browse files Browse the repository at this point in the history
  • Loading branch information
korgan00 committed Oct 17, 2024
1 parent 57e3334 commit 7402e53
Showing 1 changed file with 15 additions and 22 deletions.
37 changes: 15 additions & 22 deletions client/qiskit_serverless/core/clients/local_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -163,37 +163,30 @@ def filtered_logs(self, job_id: str, **kwargs):
####### Functions #######
#########################

def upload(self, program: QiskitFunction):
def upload(self, program: QiskitFunction) -> Optional[QiskitFunction]:
# check if entrypoint exists
if not os.path.exists(os.path.join(program.working_dir, program.entrypoint)):
raise QiskitServerlessException(
f"Entrypoint file [{program.entrypoint}] does not exist "
f"in [{program.working_dir}] working directory."
)
self._patterns.append(
{
"title": program.title,
"provider": program.provider,
"entrypoint": program.entrypoint,
"working_dir": program.working_dir,
"env_vars": program.env_vars,
"arguments": json.dumps({}),
"dependencies": json.dumps(program.dependencies or []),
}
)
return program.title

pattern = {
"title": program.title,
"provider": program.provider,
"entrypoint": program.entrypoint,
"working_dir": program.working_dir,
"env_vars": program.env_vars,
"arguments": json.dumps({}),
"dependencies": json.dumps(program.dependencies or []),
"client": self,
}
self._patterns.append(pattern)
return QiskitFunction.from_json(pattern)

def functions(self, **kwargs) -> List[QiskitFunction]:
"""Returns list of programs."""
return [
QiskitFunction(
program.get("title"),
provider=program.get("provider", None),
raw_data=program,
client=self,
)
for program in self._patterns
]
return [QiskitFunction.from_json(program) for program in self._patterns]

def function(
self, title: str, provider: Optional[str] = None
Expand Down

0 comments on commit 7402e53

Please sign in to comment.