diff --git a/coordinator/Processor.py b/coordinator/Processor.py index c65cbf6a94f60df0085019b6cf0dc70d375bae37..cf0f28cc559eaabf95c3b6f6f1057e4455da6cec 100755 --- a/coordinator/Processor.py +++ b/coordinator/Processor.py @@ -255,14 +255,14 @@ class Processor: # positional arguments do not start with - or -- and are always required # optional arguments start with - or -- and default is required = False - my_parser.add_argument( - '-p', '--component', - type = str, - choices = list(short_name.keys()), - required = True, - dest = 'component', - help = '''Name of EWS component to process, which must be present - in the config file.''') + # my_parser.add_argument( + # '-p', '--component', + # type = str, + # choices = list(short_name.keys()), + # required = True, + # dest = 'component', + # help = '''Name of EWS component to process, which must be present + # in the config file.''') my_parser.add_argument( '-c', '--config', @@ -365,9 +365,9 @@ class Processor: if not universal_config: universal_config = { 'WorkspacePathout': set(), - 'ProcessPreJob': set(), - 'ProcessInJob': set(), - 'ProcessEWSPlotting': set(), + # 'ProcessPreJob': set(), + # 'ProcessInJob': set(), + # 'ProcessEWSPlotting': set(), 'ServerPath': set(), 'ServerName': set(), 'ServerKey': set()} @@ -517,11 +517,11 @@ class Processor: with open(f"{jobPath}/{configFileName}.json", 'w') as write_file: json.dump(configjson, write_file, indent = 4) - proc_description = universal_config['ProcessInJob'] + # proc_description = universal_config['ProcessInJob'] try: proc_out = self.process_in_job(jobPath, status, configjson, component) except: - self.logger.exception(f"Some error in {proc_description}()") + self.logger.exception(f"Error in process_in_job") status.reset('ERROR') endJob(status, premature = True) @@ -632,7 +632,7 @@ class Processor: raise NotImplementedError - def run_processor(self): + def run_processor(self, component: str): print("Make sure to `conda activate py3EWSepi` environment!") print("Make sure that flagdir package is available (on PYTHONPATH)") try: @@ -640,6 +640,7 @@ class Processor: self.logger.info(f"Logging started at {datetime.datetime.now().strftime('%Y %b %d %H:%M:%S')}") # load configurations args_dict: dict = self.parse_and_check_args() + args_dict["component"] = component self.set_log_level(args_dict['log_level']) self.run_process(args_dict) except SystemExit as e: diff --git a/coordinator/ProcessorAdvisory.py b/coordinator/ProcessorAdvisory.py index 4d78e795b83c52a2c5fda0d1c54375f15b9c7305..c3f22028dc2c13e0447eacbbb7d0b51e30aebca5 100644 --- a/coordinator/ProcessorAdvisory.py +++ b/coordinator/ProcessorAdvisory.py @@ -65,3 +65,8 @@ class ProcessorAdvisory(Processor): proc_out['clearup'] = None return proc_out + + +if __name__ == '__main__': + processor = ProcessorAdvisory() + processor.run_processor("Advisory") \ No newline at end of file diff --git a/coordinator/ProcessorDeposition.py b/coordinator/ProcessorDeposition.py index 6a93c1ce1d880b3614a66ba4ec6dac51f15e37e8..9fcba63baafb000262aec7a91d02c72ff67b16b6 100644 --- a/coordinator/ProcessorDeposition.py +++ b/coordinator/ProcessorDeposition.py @@ -22,6 +22,8 @@ from ews_postprocessing.deposition.deposition_post_processor import DepositionPo class ProcessorDeposition(Processor): + """ LIFECYCLE FUNCTIONS INHERITED FROM PROCESSOR.PY """ + def process_pre_job(self, args): return process_pre_job_server_download(args) @@ -39,6 +41,7 @@ class ProcessorDeposition(Processor): logger = logging.getLogger('Processor.Deposition') add_filters_to_sublogger(logger) + """ LIFECYCLE FUNCTIONS INHERITED FROM PROCESSOR.PY """ def process_in_job_dep(self, jobPath, status, config, component): self.logger.info('started process_in_job_dep()') @@ -181,4 +184,4 @@ class ProcessorDeposition(Processor): if __name__ == '__main__': processor = ProcessorDeposition() - processor.run_processor() + processor.run_processor("Deposition") diff --git a/coordinator/ProcessorEnvironment.py b/coordinator/ProcessorEnvironment.py index d76205ed8a3970aa5b240cee8b68f530f2bc3f5b..df64fc01a2216e1b7141c9e0951db5424c3e9438 100644 --- a/coordinator/ProcessorEnvironment.py +++ b/coordinator/ProcessorEnvironment.py @@ -237,3 +237,8 @@ class ProcessorEnvironment(Processor): EWSPlottingOutputs = sorted([file for glob_str in EWSPlottingOutputGlobs for file in glob(glob_str)]) return EWSPlottingOutputs + + +if __name__ == '__main__': + processor = ProcessorEnvironment() + processor.run_processor("Environment") diff --git a/coordinator/ProcessorEpidemiology.py b/coordinator/ProcessorEpidemiology.py index d80f827d8adc5969be8ec60299acd48cf2c4f38f..ceb85afeb318cf7b7b2a6bcc45d97eb60fc196cd 100644 --- a/coordinator/ProcessorEpidemiology.py +++ b/coordinator/ProcessorEpidemiology.py @@ -831,3 +831,8 @@ class ProcessorEpidemiology(Processor): EWSPlottingOutputs = [item for EWSPlottingOutput in EWSPlottingOutputGlobs for item in glob(EWSPlottingOutput)] return EWSPlottingOutputs + + +if __name__ == '__main__': + processor = ProcessorEpidemiology() + processor.run_processor("Epidemiology") \ No newline at end of file diff --git a/coordinator/ProcessorSurveys.py b/coordinator/ProcessorSurveys.py index 41777d0ffd93787bbb684499e06c70bf526acaa8..33bbd9edbaa83381f05bf8569e69e79458e4b06e 100644 --- a/coordinator/ProcessorSurveys.py +++ b/coordinator/ProcessorSurveys.py @@ -459,3 +459,8 @@ class ProcessorSurveys(Processor): pass return [] + + +if __name__ == '__main__': + processor = ProcessorSurveys() + processor.run_processor("Survey") \ No newline at end of file