Repository: Duke-GCB/lando

Issue:
k8s record job run time and file info
The organize project needs to save this info in the resulting project.
Functionality split off from #139

Currently the implementation just returns a placeholder value:
https://github.com/Duke-GCB/lando/blob/38747c5e75a93caf4a4228ce18bbae75442a507c/lando/k8s/jobmanager.py#L237

Need to figure out how to gather this data and pass the filename or data to organize output.

Where the openstack lando worker creates this:
https://github.com/Duke-GCB/lando/blob/38747c5e75a93caf4a4228ce18bbae75442a507c/lando/worker/cwlworkflow.py#L329-L337

Discussion:

Patch:
diff --git a/lando/k8s/jobmanager.py b/lando/k8s/jobmanager.py
index d9b893e..c73cbfb 100644
--- a/lando/k8s/jobmanager.py
+++ b/lando/k8s/jobmanager.py
@@ -233,10 +233,10 @@ class JobManager(object):
 
     def _create_organize_output_config_map(self, name, filename, methods_document_content):
         config_data = {
+            "bespin_job_id": self.job.id,
             "destination_dir": Paths.OUTPUT_RESULTS_DIR,
             "workflow_path": self.names.workflow_path,
             "job_order_path": self.names.job_order_path,
-            "job_data_path": "TODO",
             "bespin_workflow_stdout_path": self.names.run_workflow_stdout_path,
             "bespin_workflow_stderr_path": self.names.run_workflow_stderr_path,
             "methods_template": methods_document_content,


Test patch:
diff --git a/lando/k8s/tests/test_jobmanager.py b/lando/k8s/tests/test_jobmanager.py
index c33208b..2a5e99e 100644
--- a/lando/k8s/tests/test_jobmanager.py
+++ b/lando/k8s/tests/test_jobmanager.py
@@ -251,10 +251,10 @@ class TestJobManager(TestCase):
             data={
                 'organizeoutput.json':
                     json.dumps({
+                        "bespin_job_id": '51',
                         "destination_dir": "/bespin/output-data/results",
                         "workflow_path": "/bespin/job-data/workflow/someurl",
                         "job_order_path": "/bespin/job-data/job-order.json",
-                        "job_data_path": "TODO",
                         "bespin_workflow_stdout_path": "/bespin/output-data/bespin-workflow-output.json",
                         "bespin_workflow_stderr_path": "/bespin/output-data/bespin-workflow-output.log",
                         "methods_template": "markdown"