Skip to content

Commit 04f318b

Browse files
authored
Merge pull request #34 from Loxeris/fix-use-postprocess-value
Check post-process returned value for job success
2 parents eca277c + dd3e8ff commit 04f318b

File tree

4 files changed

+21
-10
lines changed

4 files changed

+21
-10
lines changed

src/dirac_cwl_proto/execution_hooks/plugins/lhcb.py

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -325,7 +325,12 @@ def post_process(self, job_path: Path, **kwargs: Any) -> bool:
325325
catalog_files = glob.glob(str(job_path / "pool_xml_catalog.xml"))
326326
for catalog_file in catalog_files:
327327
try:
328-
self.store_output("pool_xml_catalog", catalog_file)
328+
self.store_output(
329+
"pool_xml_catalog",
330+
catalog_file,
331+
task_id=self.task_id,
332+
run_id=self.run_id,
333+
)
329334
except Exception as e:
330335
print(f"Failed to store catalog {catalog_file}: {e}")
331336
success = False
@@ -407,7 +412,9 @@ def post_process(self, job_path: Path, **kwargs: Any) -> bool:
407412
dst_files = glob.glob(str(job_path / "*.dst"))
408413
for dst_file in dst_files:
409414
try:
410-
self.store_output("dst", dst_file)
415+
self.store_output(
416+
"dst", dst_file, task_id=self.task_id, run_id=self.run_id
417+
)
411418
except Exception as e:
412419
print(f"Failed to store DST output {dst_file}: {e}")
413420
success = False
@@ -416,7 +423,9 @@ def post_process(self, job_path: Path, **kwargs: Any) -> bool:
416423
log_files = glob.glob(str(job_path / "*.log"))
417424
for log_file in log_files:
418425
try:
419-
self.store_output("log", log_file)
426+
self.store_output(
427+
"log", log_file, task_id=self.task_id, run_id=self.run_id
428+
)
420429
except Exception as e:
421430
print(f"Failed to store log {log_file}: {e}")
422431
success = False

src/dirac_cwl_proto/job/__init__.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -396,15 +396,17 @@ def run_job(job: JobSubmissionModel) -> bool:
396396

397397
# Post-process the job
398398
logger.info("Post-processing Task...")
399-
_post_process(
399+
if _post_process(
400400
result.returncode,
401401
result.stdout,
402402
result.stderr,
403403
job_path,
404404
runtime_metadata,
405-
)
406-
logger.info("Task post-processed successfully!")
407-
return True
405+
):
406+
logger.info("Task post-processed successfully!")
407+
return True
408+
logger.error("Failed to post-process Task")
409+
return False
408410

409411
except Exception:
410412
logger.exception("JobWrapper: Failed to execute workflow")

test/test_workflows.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -316,7 +316,7 @@ def test_run_job_validation_failure(
316316
# --- Gaussian fit example ---
317317
# Data generation workflow
318318
(
319-
"test/workflows/gaussian_fit/data_generation/data-generation.cwl",
319+
"test/workflows/gaussian_fit/data_generation/data-generation-workflow.cwl",
320320
"test/workflows/gaussian_fit/type_dependencies/transformation/inputs-data-generation.yaml",
321321
),
322322
],

test/workflows/gaussian_fit/data_generation/data-generation-workflow.cwl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,10 @@ doc: >
77
inputs:
88
output_file_name_1:
99
type: string
10-
default: "data1.txt"
10+
default: "data-gen1.txt"
1111
output_file_name_2:
1212
type: string
13-
default: "data2.txt"
13+
default: "data-gen2.txt"
1414

1515
outputs:
1616
data1:

0 commit comments

Comments
 (0)