Skip to content

Commit

Permalink
refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
sanderegg committed Oct 15, 2024
1 parent 2e1f0ec commit 3481ec3
Showing 1 changed file with 8 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down Expand Up @@ -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:
Expand All @@ -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("*"))
Expand Down Expand Up @@ -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,
Expand Down

0 comments on commit 3481ec3

Please sign in to comment.