Skip to content

Commit 119b611

Browse files
authored
Merge pull request #148 from hsorby/main
Add provenance info to config maker output.
2 parents b167e44 + b36e5c9 commit 119b611

File tree

2 files changed

+11
-4
lines changed

2 files changed

+11
-4
lines changed

src/mapclient/application.py

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
You should have received a copy of the GNU General Public License
1919
along with MAP Client. If not, see <http://www.gnu.org/licenses/>..
2020
"""
21+
import json
2122
import os
2223
import shutil
2324
import sys
@@ -33,6 +34,7 @@
3334

3435
from mapclient.core.exitcodes import (HEADLESS_MODE_WITH_NO_WORKFLOW, INVALID_WORKFLOW_LOCATION_GIVEN, CONFIGURATION_MODE_WITH_NO_DEFINITIONS, USER_SPECIFIED_DIRECTORY,
3536
APP_SUCCESS, CONFIGURATION_MODE_NO_FILE, CONFIGURATION_MODE_NOT_IMPLEMENTED)
37+
from mapclient.core.provenance import reproducibility_info
3638
from mapclient.core.utils import is_frozen, find_file
3739
from mapclient.core.workflow.workflowscene import create_from
3840
from mapclient.settings.definitions import INTERNAL_WORKFLOWS_ZIP, INTERNAL_WORKFLOWS_AVAILABLE, INTERNAL_WORKFLOW_DIR, UNSET_FLAG, PREVIOUS_WORKFLOW, AUTOLOAD_PREVIOUS_WORKFLOW
@@ -153,7 +155,6 @@ def windows_main(workflow, execute_now):
153155
wm = model.workflowManager()
154156
if workflow and not wm.is_restricted(workflow):
155157
splash.showMessage('Opening workflow ...', 80)
156-
logger.info(f"Opening workflow: {workflow}")
157158
window.open_workflow(workflow)
158159
elif workflow:
159160
logger.info(f"Not opening workflow '{workflow}', this workflow is already in use.")
@@ -392,8 +393,6 @@ def _split_key_value_definition(text):
392393

393394

394395
def _config_maker_main(configuration_file, definitions, append):
395-
# is_file = os.path.isfile(configuration_file)
396-
# is_zip = is_zipfile(configuration_file)
397396
if configuration_file is None:
398397
logger.error("No configuration file specified.")
399398
return CONFIGURATION_MODE_NO_FILE
@@ -452,9 +451,16 @@ def _config_maker_main(configuration_file, definitions, append):
452451

453452
logger.info("Created workflow configuration files.")
454453
if not_implemented_occurred:
455-
logger.error("Not all steps required support configuration making.")
454+
logger.error("Not all steps defined support configuration making.")
456455
return CONFIGURATION_MODE_NOT_IMPLEMENTED
457456

457+
provenance = reproducibility_info()
458+
provenance_file = os.path.join(location, "provenance.json")
459+
with open(provenance_file, "w") as f:
460+
f.write(json.dumps(provenance, default=lambda o: o.__dict__, sort_keys=True, indent=2))
461+
files_created.append(provenance_file)
462+
logger.info("Created provenance file.")
463+
458464
zip_file = os.path.join(location, "workflow-settings.zip")
459465

460466
with ZipFile(zip_file, "w") as fh:

src/mapclient/view/workflow/workflowwidget.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -356,6 +356,7 @@ def open(self):
356356
def open_workflow(self, workflow_dir):
357357
result = ''
358358
if len(workflow_dir):
359+
logger.info(f"Opening workflow: {workflow_dir}")
359360
try:
360361
logger.info('Performing workflow checks on open ...')
361362
self.performWorkflowChecks(workflow_dir)

0 commit comments

Comments
 (0)