From 718600dc13533e78bc23447f4c3cb3f1bf3b58e4 Mon Sep 17 00:00:00 2001 From: Robert Izzard <r.izzard@surrey.ac.uk> Date: Tue, 9 Nov 2021 11:42:19 +0000 Subject: [PATCH] add system info from the original calling script (and starttime, etc.) to slurm --- binarycpython/utils/grid.py | 7 +++++++ binarycpython/utils/grid_options_defaults.py | 11 +++++++++++ 2 files changed, 18 insertions(+) diff --git a/binarycpython/utils/grid.py b/binarycpython/utils/grid.py index 95bfa0665..f7e870b5a 100644 --- a/binarycpython/utils/grid.py +++ b/binarycpython/utils/grid.py @@ -5138,6 +5138,13 @@ eccentricity3=0 value=self.grid_options['slurm_extra_settings'][key] )] + # save original command line, working directory, time + lines += [ + "\nexport BINARY_C_PYTHON_ORIGINAL_CMD_LINE={cmdline}".format(cmdline=repr(self.grid_options['command_line'])), + "\nexport BINARY_C_PYTHON_ORIGINAL_WD=`pwd`", + "\nexport BINARY_C_PYTHON_ORIGINAL_SUBMISSION_TIME=`date`", + ] + lines += [ "\n# set status to \"running\"\n", diff --git a/binarycpython/utils/grid_options_defaults.py b/binarycpython/utils/grid_options_defaults.py index 7435fde92..12d2cc9a4 100644 --- a/binarycpython/utils/grid_options_defaults.py +++ b/binarycpython/utils/grid_options_defaults.py @@ -13,6 +13,7 @@ With this its also possible to automatically generate a document containing all All the options starting with _ should not be changed by the user except when you really know what you're doing (which is probably hacking the code :P) """ +import datetime import os import sys @@ -50,7 +51,17 @@ grid_options_defaults_dict = { "do_dry_run": True, # Whether to do a dry run to calculate the total probability for this run "custom_generator": None, # Place for the custom system generator "exit_after_dry_run": False, # Exit after dry run? + + ##################### + # System information + ##################### "command_line": ' '.join(sys.argv), + "original_command_line": os.getenv('BINARY_C_PYTHON_ORIGINAL_CMD_LINE'), + "working_diretory": os.getcwd(), + "original_working_diretory": os.getenv('BINARY_C_PYTHON_ORIGINAL_WD'), + "start_time": datetime.datetime.now().strftime("%d/%m/%Y %H:%M:%S"), + "original_submission_time" : os.getenv('BINARY_C_PYTHON_ORIGINAL_SUBMISSION_TIME'), + ########################## # Execution log: ########################## -- GitLab