Skip to content

Commit

Permalink
black and lint fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
guzzijones committed Oct 10, 2023
1 parent 605447b commit 2433cb0
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions st2common/bin/migrations/v3.9/st2-migrate-liveaction-executiondb
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ from st2common.models.db.execution import ActionExecutionDB
from st2common.constants.action import (
LIVEACTION_COMPLETED_STATES,
LIVEACTION_STATUS_PAUSED,
LIVEACTION_STATUS_PENDING
LIVEACTION_STATUS_PENDING,
)

# NOTE: To avoid unnecessary mongoengine object churn when retrieving only object ids (aka to avoid
Expand All @@ -69,7 +69,8 @@ def migrate_executions(start_dt: datetime.datetime, end_dt: datetime.datetime) -
res_count = ActionExecutionDB.objects(
__raw__={
"status": {
"$in": LIVEACTION_COMPLETED_STATES + [LIVEACTION_STATUS_PAUSED, LIVEACTION_STATUS_PENDING],
"$in": LIVEACTION_COMPLETED_STATES
+ [LIVEACTION_STATUS_PAUSED, LIVEACTION_STATUS_PENDING],
},
},
start_timestamp__gte=start_dt,
Expand All @@ -80,13 +81,14 @@ def migrate_executions(start_dt: datetime.datetime, end_dt: datetime.datetime) -
ActionExecutionDB.objects(__raw__={"_id": item["_id"]}).update(
__raw__={"$set": {"liveaction_id": item["liveaction"]["id"]}}
)
except KeyError as e:
except KeyError:
pass

ActionExecutionDB.objects(
__raw__={
"status": {
"$in": LIVEACTION_COMPLETED_STATES + [LIVEACTION_STATUS_PAUSED, LIVEACTION_STATUS_PENDING],
"$in": LIVEACTION_COMPLETED_STATES
+ [LIVEACTION_STATUS_PAUSED, LIVEACTION_STATUS_PENDING],
},
},
start_timestamp__gte=start_dt,
Expand Down

0 comments on commit 2433cb0

Please sign in to comment.