Skip to content

Commit 757a77e

Browse files
update suite_report
1 parent 43045a0 commit 757a77e

2 files changed

Lines changed: 16 additions & 15 deletions

File tree

github_scripts/suite_data.py

Lines changed: 15 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
"""
1010

1111
import re
12+
import os
1213
import shutil
1314
import sqlite3
1415
import subprocess
@@ -18,6 +19,7 @@
1819
from typing import Dict, List, Optional, Set, Union
1920
from git_bdiff import GitBDiff, GitInfo
2021

22+
2123
class SuiteData:
2224
"""
2325
Class to gather info on a suite
@@ -188,6 +190,8 @@ def populate_gitinfo(self) -> None:
188190
"""
189191

190192
for dependency in self.dependencies:
193+
print(dependency)
194+
print(self.temp_directory)
191195
self.dependencies[dependency]["gitinfo"] = GitInfo(
192196
self.temp_directory / dependency
193197
)
@@ -283,21 +287,18 @@ def read_rose_conf(self) -> Dict[str, str]:
283287

284288
def find_unknown_dependency(self, dependency: str) -> str:
285289
"""
286-
TEMPORARY
287290
The primary dependency may be unset in the dependencies file. In this case find
288-
it from the *_SOURCE variable in the rose-suite.conf.
289-
TODO: Once cylc provides the location of the source code itself, this method
290-
should be changed to use that instead, as then the _SOURCE variable will be
291-
removed
292-
"""
293-
294-
var = f"{dependency.upper()}_SOURCE".replace('"', "")
295-
if var not in self.rose_data:
296-
raise RuntimeError(f"Cant determine source for {dependency}")
297-
rval = self.rose_data[var]
298-
if "$ROSE_ORIG_HOST" in rval:
299-
rval = rval.replace("$ROSE_ORIG_HOST", self.rose_data["ROSE_ORIG_HOST"])
300-
return rval
291+
it from the CYLC_WORKFLOW_SRC_DIR variable that gets set in the
292+
flow-processed.cylc file
293+
"""
294+
295+
log_file = self.suite_path / "log" / "scheduler" / "log"
296+
with open(log_file, "r") as f:
297+
for line in f:
298+
line = line.strip()
299+
if re.search(f"{dependency.upper()} SOURCE CLONE=", line):
300+
return line.split("=")[1].rstrip("/")
301+
raise RuntimeError(f"Unable to find source for dependency {dependency}")
301302

302303
def read_dependencies(self) -> Dict[str, Dict]:
303304
"""

github_scripts/suite_report_git.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -373,8 +373,8 @@ def main() -> None:
373373

374374
args = parse_args()
375375

376+
suite_report = SuiteReport(args.suite_path)
376377
try:
377-
suite_report = SuiteReport(args.suite_path)
378378
suite_report.create_log()
379379
suite_report.write_log(args.log_path)
380380
finally:

0 commit comments

Comments
 (0)