diff --git a/services/director-v2/src/simcore_service_director_v2/modules/db/repositories/comp_runs.py b/services/director-v2/src/simcore_service_director_v2/modules/db/repositories/comp_runs.py index f52607e4bc0a..4f9a8e42b53c 100644 --- a/services/director-v2/src/simcore_service_director_v2/modules/db/repositories/comp_runs.py +++ b/services/director-v2/src/simcore_service_director_v2/modules/db/repositories/comp_runs.py @@ -50,7 +50,7 @@ async def get( ) row: RowProxy | None = await result.first() if not row: - raise ComputationalRunNotFoundError() + raise ComputationalRunNotFoundError return CompRunsAtDB.from_orm(row) async def list( @@ -80,7 +80,7 @@ async def create( project_id: ProjectID, cluster_id: ClusterID, iteration: PositiveInt | None = None, - metadata: RunMetadataDict | None, + metadata: RunMetadataDict, use_on_demand_clusters: bool, ) -> CompRunsAtDB: try: @@ -102,13 +102,13 @@ async def create( .values( user_id=user_id, project_uuid=f"{project_id}", - cluster_id=cluster_id - if cluster_id != DEFAULT_CLUSTER_ID - else None, + cluster_id=( + cluster_id if cluster_id != DEFAULT_CLUSTER_ID else None + ), iteration=iteration, result=RUNNING_STATE_TO_DB[RunningState.PUBLISHED], - started=datetime.datetime.now(tz=datetime.timezone.utc), - metadata=jsonable_encoder(metadata) if metadata else None, + started=datetime.datetime.now(tz=datetime.UTC), + metadata=jsonable_encoder(metadata), use_on_demand_clusters=use_on_demand_clusters, ) .returning(literal_column("*")) @@ -146,7 +146,7 @@ async def set_run_result( ) -> CompRunsAtDB | None: values: dict[str, Any] = {"result": RUNNING_STATE_TO_DB[result_state]} if final_state: - values.update({"ended": datetime.datetime.now(tz=datetime.timezone.utc)}) + values.update({"ended": datetime.datetime.now(tz=datetime.UTC)}) return await self.update( user_id, project_id,