|
18 | 18 | You should have received a copy of the GNU General Public License |
19 | 19 | along with MAP Client. If not, see <http://www.gnu.org/licenses/>.. |
20 | 20 | """ |
| 21 | +import json |
21 | 22 | import os |
22 | 23 | import shutil |
23 | 24 | import sys |
|
33 | 34 |
|
34 | 35 | from mapclient.core.exitcodes import (HEADLESS_MODE_WITH_NO_WORKFLOW, INVALID_WORKFLOW_LOCATION_GIVEN, CONFIGURATION_MODE_WITH_NO_DEFINITIONS, USER_SPECIFIED_DIRECTORY, |
35 | 36 | APP_SUCCESS, CONFIGURATION_MODE_NO_FILE, CONFIGURATION_MODE_NOT_IMPLEMENTED) |
| 37 | +from mapclient.core.provenance import reproducibility_info |
36 | 38 | from mapclient.core.utils import is_frozen, find_file |
37 | 39 | from mapclient.core.workflow.workflowscene import create_from |
38 | 40 | 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): |
153 | 155 | wm = model.workflowManager() |
154 | 156 | if workflow and not wm.is_restricted(workflow): |
155 | 157 | splash.showMessage('Opening workflow ...', 80) |
156 | | - logger.info(f"Opening workflow: {workflow}") |
157 | 158 | window.open_workflow(workflow) |
158 | 159 | elif workflow: |
159 | 160 | logger.info(f"Not opening workflow '{workflow}', this workflow is already in use.") |
@@ -392,8 +393,6 @@ def _split_key_value_definition(text): |
392 | 393 |
|
393 | 394 |
|
394 | 395 | def _config_maker_main(configuration_file, definitions, append): |
395 | | - # is_file = os.path.isfile(configuration_file) |
396 | | - # is_zip = is_zipfile(configuration_file) |
397 | 396 | if configuration_file is None: |
398 | 397 | logger.error("No configuration file specified.") |
399 | 398 | return CONFIGURATION_MODE_NO_FILE |
@@ -452,9 +451,16 @@ def _config_maker_main(configuration_file, definitions, append): |
452 | 451 |
|
453 | 452 | logger.info("Created workflow configuration files.") |
454 | 453 | if not_implemented_occurred: |
455 | | - logger.error("Not all steps required support configuration making.") |
| 454 | + logger.error("Not all steps defined support configuration making.") |
456 | 455 | return CONFIGURATION_MODE_NOT_IMPLEMENTED |
457 | 456 |
|
| 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 | + |
458 | 464 | zip_file = os.path.join(location, "workflow-settings.zip") |
459 | 465 |
|
460 | 466 | with ZipFile(zip_file, "w") as fh: |
|
0 commit comments