Skip to content

Commit b571b3c

Browse files
Use run_dir from Config for monitoring path (#3100)
Prior to this PR, the default was hard-coded to "runinfo/" (in PR #2136) which works most of the time, as most of the time, users do not change the Config run_dir. However, PR #3003 sets Config.run_dir for most tests, resulting in a (mostly silent) monitoring database manager failure. This PR fixes that by allowing monitoring to see that new path, as well as fixing it for all other run_dir changing users. Note that in Config/DFK there are two uses of the "run_dir" : in Config, that name refers to the root in which .../000/... /NNN/ directories will be created. In the DFK, that name refers to the numbered config.DFK/NNN/ directory. Since #3003 (which I bisected back to), monitoring has been mostly silently failing with a database opening error appearing in database_manager.log and a missing monitoring.db, but no exception raised in the workflow process. This PR does not address that loss-of-failure-info problem. Co-authored-by: Kevin Hunter Kesling <[email protected]>
1 parent ced02da commit b571b3c

File tree

2 files changed

+8
-5
lines changed

2 files changed

+8
-5
lines changed

parsl/dataflow/dflow.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ def __init__(self, config: Config) -> None:
113113
if self.monitoring.logdir is None:
114114
self.monitoring.logdir = self.run_dir
115115
self.hub_address = self.monitoring.hub_address
116-
self.hub_interchange_port = self.monitoring.start(self.run_id, self.run_dir)
116+
self.hub_interchange_port = self.monitoring.start(self.run_id, self.run_dir, self.config.run_dir)
117117

118118
self.time_began = datetime.datetime.now()
119119
self.time_completed: Optional[datetime.datetime] = None

parsl/monitoring/monitoring.py

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ def __init__(self,
8484

8585
workflow_name: Optional[str] = None,
8686
workflow_version: Optional[str] = None,
87-
logging_endpoint: str = 'sqlite:///runinfo/monitoring.db',
87+
logging_endpoint: Optional[str] = None,
8888
logdir: Optional[str] = None,
8989
monitoring_debug: bool = False,
9090
resource_monitoring_enabled: bool = True,
@@ -118,7 +118,7 @@ def __init__(self,
118118
logging_endpoint : str
119119
The database connection url for monitoring to log the information.
120120
These URLs follow RFC-1738, and can include username, password, hostname, database name.
121-
Default: 'sqlite:///monitoring.db'
121+
Default: sqlite, in the configured run_dir.
122122
logdir : str
123123
Parsl log directory paths. Logs and temp files go here. Default: '.'
124124
monitoring_debug : Bool
@@ -162,11 +162,14 @@ def __init__(self,
162162
self.resource_monitoring_enabled = resource_monitoring_enabled
163163
self.resource_monitoring_interval = resource_monitoring_interval
164164

165-
def start(self, run_id: str, run_dir: str) -> int:
165+
def start(self, run_id: str, dfk_run_dir: str, config_run_dir: Union[str, os.PathLike]) -> int:
166166

167167
if self.logdir is None:
168168
self.logdir = "."
169169

170+
if self.logging_endpoint is None:
171+
self.logging_endpoint = f"sqlite:///{os.fspath(config_run_dir)}/monitoring.db"
172+
170173
os.makedirs(self.logdir, exist_ok=True)
171174

172175
# Initialize the ZMQ pipe to the Parsl Client
@@ -231,7 +234,7 @@ def start(self, run_id: str, run_dir: str) -> int:
231234
self.logger.info("Started the router process {} and DBM process {}".format(self.router_proc.pid, self.dbm_proc.pid))
232235

233236
self.filesystem_proc = Process(target=filesystem_receiver,
234-
args=(self.logdir, self.resource_msgs, run_dir),
237+
args=(self.logdir, self.resource_msgs, dfk_run_dir),
235238
name="Monitoring-Filesystem-Process",
236239
daemon=True
237240
)

0 commit comments

Comments
 (0)