Skip to content

Commit

Permalink
[pre-commit.ci] auto fixes from pre-commit.com hooks
Browse files Browse the repository at this point in the history
for more information, see https://pre-commit.ci
  • Loading branch information
pre-commit-ci[bot] committed Feb 19, 2024
1 parent 97b0dc5 commit 6363b29
Show file tree
Hide file tree
Showing 12 changed files with 70 additions and 60 deletions.
1 change: 0 additions & 1 deletion covalent/_file_transfer/strategies/s3_strategy.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@


class S3(FileTransferStrategy):

"""
Implements Base FileTransferStrategy class to upload/download files from S3 Bucket.
"""
Expand Down
14 changes: 8 additions & 6 deletions covalent/_shared_files/defaults.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,9 +67,9 @@ def get_default_sdk_config():
+ "/covalent/dispatches"
),
"task_packing": "true" if os.environ.get("COVALENT_ENABLE_TASK_PACKING") else "false",
"multistage_dispatch": "false"
if os.environ.get("COVALENT_DISABLE_MULTISTAGE_DISPATCH") == "1"
else "true",
"multistage_dispatch": (
"false" if os.environ.get("COVALENT_DISABLE_MULTISTAGE_DISPATCH") == "1" else "true"
),
"results_dir": os.environ.get(
"COVALENT_RESULTS_DIR"
) # COVALENT_RESULTS_DIR is where the client downloads workflow artifacts during get_result() which is different from COVALENT_DATA_DIR
Expand Down Expand Up @@ -156,9 +156,11 @@ def get_default_workflow_data_config():
def get_default_ui_config():
return {
"address": "localhost",
"port": int(os.environ.get("COVALENT_SVC_PORT"))
if os.environ.get("COVALENT_SVC_PORT")
else 48008,
"port": (
int(os.environ.get("COVALENT_SVC_PORT"))
if os.environ.get("COVALENT_SVC_PORT")
else 48008
),
"dev_port": 49009,
"log_dir": os.environ.get("COVALENT_LOGDIR")
or os.path.join(
Expand Down
6 changes: 3 additions & 3 deletions covalent/_shared_files/qinfo.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,9 +54,9 @@ class QElectronInfo(BaseModel):
description: Optional[str] = None
device_name: str # name of the original device, e.g. "default.qubit"
device_import_path: str # used to inherit type converters and other methods
device_shots: Union[
None, int, Sequence[int], Sequence[Union[int, Sequence[int]]]
] = None # optional default for execution devices
device_shots: Union[None, int, Sequence[int], Sequence[Union[int, Sequence[int]]]] = (
None # optional default for execution devices
)
device_shots_type: Any = None
device_wires: int # this can not be reliably inferred from tapes alone
pennylane_active_return: bool # client-side status of `pennylane.active_return()`
1 change: 0 additions & 1 deletion covalent/_workflow/qdevice.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@


class QEDevice(QubitDevice):

"""
The purpose of this device is to redirect circuit execution through Covalent's
Quantum Executors and to enable asynchronous execution.
Expand Down
1 change: 0 additions & 1 deletion covalent/_workflow/transportable_object.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@


class _TOArchive:

"""Archived transportable object."""

def __init__(self, header: bytes, object_string: bytes, data: bytes):
Expand Down
16 changes: 9 additions & 7 deletions covalent/cloud_resource_manager/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,13 +98,15 @@ def get_plugin_settings(
infra_settings = ExecutorInfraDefaults.schema()["properties"]

settings_dict = {
key: {
"required": "No",
"default": value["default"],
"value": value["default"],
}
if "default" in value
else {"required": "Yes", "default": None, "value": None}
key: (
{
"required": "No",
"default": value["default"],
"value": value["default"],
}
if "default" in value
else {"required": "Yes", "default": None, "value": None}
)
for key, value in plugin_settings.items()
}
for key, value in infra_settings.items():
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,6 @@ def post_process_all(self, *args) -> Tuple[Any, List[dict]]:


class QiskitSamplerDevice(_PennylaneQiskitDevice):

"""
A base class for devices that use the Sampler primitive.
"""
Expand Down
1 change: 0 additions & 1 deletion covalent/executor/schemas.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,6 @@ class TaskSpec(BaseModel):


class ResourceMap(BaseModel):

"""Map resource identifiers to URIs.
The resources may be loaded in the compute environment from these
Expand Down
6 changes: 3 additions & 3 deletions covalent/quantum/qserver/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -348,9 +348,9 @@ def get_results(self, batch_id):
{
"execution_time": sub_result_obj.execution_time,
"result": sub_result_obj.results if executor.persist_data else None,
"result_metadata": sub_result_obj.metadata
if executor.persist_data
else None,
"result_metadata": (
sub_result_obj.metadata if executor.persist_data else None
),
}
)

Expand Down
1 change: 0 additions & 1 deletion covalent_dispatcher/_dal/asset.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,6 @@ class StorageType(Enum):


class Asset(Record[AssetRecord]):

"""Metadata for an object in blob storage"""

model = AssetRecord
Expand Down
70 changes: 41 additions & 29 deletions covalent_ui/api/v1/data_layer/electron_dal.py
Original file line number Diff line number Diff line change
Expand Up @@ -105,9 +105,11 @@ def get_jobs(
"job_id": circuit["circuit_id"],
"start_time": circuit["save_time"],
"executor": circuit["result_metadata"]["executor_name"],
"status": "COMPLETED"
if len(circuit["result"]) != 0 and len(circuit["result_metadata"]) != 0
else "RUNNING",
"status": (
"COMPLETED"
if len(circuit["result"]) != 0 and len(circuit["result_metadata"]) != 0
else "RUNNING"
),
},
jobs.values(),
)
Expand Down Expand Up @@ -164,39 +166,49 @@ def get_job_detail(self, dispatch_id, electron_id, job_id) -> JobDetailsResponse
selected_job["result"] = str(selected_job["result"])[1:-1]
job_overview = {
"overview": {
"job_name": selected_job["circuit_name"]
if "circuit_name" in selected_job
else None,
"backend": selected_job["result_metadata"]["executor_backend_name"]
if "result_metadata" in selected_job
and "executor_backend_name" in selected_job["result_metadata"]
else None,
"time_elapsed": selected_job["execution_time"]
if "execution_time" in selected_job
else None,
"job_name": (
selected_job["circuit_name"] if "circuit_name" in selected_job else None
),
"backend": (
selected_job["result_metadata"]["executor_backend_name"]
if "result_metadata" in selected_job
and "executor_backend_name" in selected_job["result_metadata"]
else None
),
"time_elapsed": (
selected_job["execution_time"]
if "execution_time" in selected_job
else None
),
"result": selected_job["result"] if "result" in selected_job else None,
"status": "COMPLETED"
if len(selected_job["result"]) != 0
and len(selected_job["result_metadata"]) != 0
else "RUNNING",
"start_time": selected_job["save_time"]
if "save_time" in selected_job
else None,
"status": (
"COMPLETED"
if len(selected_job["result"]) != 0
and len(selected_job["result_metadata"]) != 0
else "RUNNING"
),
"start_time": (
selected_job["save_time"] if "save_time" in selected_job else None
),
},
"circuit": {
"total_qbits": None,
"depth": None,
"circuit_diagram": selected_job["circuit_diagram"]
if "circuit_diagram" in selected_job
else None,
"circuit_diagram": (
selected_job["circuit_diagram"]
if "circuit_diagram" in selected_job
else None
),
},
"executor": {
"name": selected_job["qexecutor"]["name"]
if "qexecutor" in selected_job and "name" in selected_job["qexecutor"]
else None,
"executor": str(selected_job["qexecutor"])
if "qexecutor" in selected_job
else None,
"name": (
selected_job["qexecutor"]["name"]
if "qexecutor" in selected_job and "name" in selected_job["qexecutor"]
else None
),
"executor": (
str(selected_job["qexecutor"]) if "qexecutor" in selected_job else None
),
},
}

Expand Down
12 changes: 6 additions & 6 deletions covalent_ui/api/v1/data_layer/summary_dal.py
Original file line number Diff line number Diff line change
Expand Up @@ -230,12 +230,12 @@ def get_summary_overview(self) -> Lattice:
return DispatchDashBoardResponse(
total_jobs_running=total_jobs_running[0],
total_jobs_completed=total_jobs_done[0],
latest_running_task_status=last_ran_job_status[0]
if last_ran_job_status is not None
else None,
total_dispatcher_duration=int(run_time[0])
if run_time is not None and run_time[0] is not None
else 0,
latest_running_task_status=(
last_ran_job_status[0] if last_ran_job_status is not None else None
),
total_dispatcher_duration=(
int(run_time[0]) if run_time is not None and run_time[0] is not None else 0
),
total_jobs_failed=total_failed[0],
total_jobs_cancelled=total_jobs_cancelled[0],
total_jobs_new_object=total_jobs_new_object[0],
Expand Down

0 comments on commit 6363b29

Please sign in to comment.