Skip to content

Commit

Permalink
Change new flow time calc (thanks MetRonnie).
Browse files Browse the repository at this point in the history
  • Loading branch information
hjoliver committed Jan 25, 2024
1 parent ce2065b commit d9cc3bb
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
9 changes: 5 additions & 4 deletions cylc/flow/flow_mgr.py
Original file line number Diff line number Diff line change
Expand Up @@ -117,11 +117,12 @@ def stringify_flow_nums(flow_nums: Set[int], full: bool = False) -> str:
class FlowMgr:
"""Logic to manage flow counter and flow metadata."""

def __init__(self, db_mgr: "WorkflowDatabaseManager") -> None:
def __init__(self, db_mgr: "WorkflowDatabaseManager", utc: bool) -> None:
"""Initialise the flow manager."""
self.db_mgr = db_mgr
self.flows: Dict[int, Dict[str, str]] = {}
self.counter: int = 0
self._timezone = datetime.timezone.utc if utc else None

def get_flow_num(
self,
Expand Down Expand Up @@ -155,9 +156,9 @@ def get_flow_num(
)
else:
# Record a new flow.
now = datetime.datetime.now()
now_sec: str = str(
now - datetime.timedelta(microseconds=now.microsecond))
now_sec = datetime.datetime.now(self._timezone).isoformat(
timespec="seconds"
)
meta = meta or "no description"
self.flows[flow_num] = {
"description": meta,
Expand Down
3 changes: 2 additions & 1 deletion cylc/flow/scheduler.py
Original file line number Diff line number Diff line change
Expand Up @@ -364,7 +364,6 @@ async def initialise(self):
self.data_store_mgr = DataStoreMgr(self)
self.broadcast_mgr = BroadcastMgr(
self.workflow_db_mgr, self.data_store_mgr)
self.flow_mgr = FlowMgr(self.workflow_db_mgr)

self.server = WorkflowRuntimeServer(self)

Expand Down Expand Up @@ -458,6 +457,8 @@ async def configure(self, params):
self.options.cycle_point_tz = (
self.config.cfg['scheduler']['cycle point time zone'])

self.flow_mgr = FlowMgr(self.workflow_db_mgr, self.options.utc_mode)

# Note that daemonization happens after this:
self.log_start()

Expand Down

0 comments on commit d9cc3bb

Please sign in to comment.