Skip to content

Commit

Permalink
scan: update workflow_params to use public db (#4998)
Browse files Browse the repository at this point in the history
* The workflow_params function was using the private DB to list workflow
  params.
* Really it should be using the public DB as only the scheduler
  process/thread should be accessing the private DB to avoid the
  potential for DB locking.
  • Loading branch information
oliver-sanders authored Aug 12, 2022
1 parent 2e7a3bb commit b338a91
Showing 1 changed file with 13 additions and 5 deletions.
18 changes: 13 additions & 5 deletions cylc/flow/network/scan.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,10 @@
ClientTimeout,
WorkflowRuntimeClient,
)
from cylc.flow.pathutil import get_cylc_run_dir
from cylc.flow.pathutil import (
get_cylc_run_dir,
get_workflow_run_dir,
)
from cylc.flow.rundb import CylcWorkflowDAO
from cylc.flow.workflow_files import (
ContactFileFields,
Expand Down Expand Up @@ -528,11 +531,16 @@ def _callback(_, entry):
key, value = entry
params[key] = value

db_file = flow['path'] / SERVICE / 'db'
# NOTE: use the public DB for reading
# (only the scheduler process/thread should access the private database)
db_file = Path(get_workflow_run_dir(flow['name'], 'log', 'db'))
if db_file.exists():
dao = CylcWorkflowDAO(db_file, is_public=False)
dao.connect()
dao.select_workflow_params(_callback)
flow['workflow_params'] = params
try:
dao.connect()
dao.select_workflow_params(_callback)
flow['workflow_params'] = params
finally:
dao.close()

return flow

0 comments on commit b338a91

Please sign in to comment.