diff --git a/autosubmit/autosubmit.py b/autosubmit/autosubmit.py index 34f671680d7a6741da4fa76b875f4634ddf0222e..92cce96ac330a483f30f14e3e6b79e86b47e086b 100644 --- a/autosubmit/autosubmit.py +++ b/autosubmit/autosubmit.py @@ -192,7 +192,7 @@ class Autosubmit: subparser.add_argument('-rom', '--run_only_members', required=False, help='Sets members allowed on this run.') subparser.add_argument('-p', '--profile', action='store_true', default=False, required=False, - help='Prints performance parameters of the execution of this experiment.') + help='Prints performance parameters of the execution of this function.') # Expid @@ -279,6 +279,9 @@ class Autosubmit: # default=False, help='Shows Job List view in terminal') subparser.add_argument('-v', '--update_version', action='store_true', default=False, help='Update experiment version') + subparser.add_argument('-p', '--profile', action='store_true', default=False, required=False, + help='Prints performance parameters of the execution of this function.') + # Stats subparser = subparsers.add_parser( 'stats', description="plots statistics for specified experiment") @@ -437,6 +440,8 @@ class Autosubmit: default=False, help='Generate possible wrapper in the current workflow') subparser.add_argument('-v', '--update_version', action='store_true', default=False, help='Update experiment version') + subparser.add_argument('-p', '--profile', action='store_true', default=False, required=False, + help='Prints performance parameters of the execution of this function.') # Configure subparser = subparsers.add_parser('configure', description="configure database and path for autosubmit. It " "can be done at machine, user or local level." @@ -659,7 +664,7 @@ class Autosubmit: return Autosubmit.monitor(args.expid, args.output, args.list, args.filter_chunks, args.filter_status, args.filter_type, args.hide, args.text, args.group_by, args.expand, args.expand_status, args.hide_groups, args.notransitive, args.check_wrapper, - args.txt_logfiles, detail=False) + args.txt_logfiles, args.profile, detail=False) elif args.command == 'stats': return Autosubmit.statistics(args.expid, args.filter_type, args.filter_period, args.output, args.hide, args.notransitive) @@ -683,7 +688,7 @@ class Autosubmit: return Autosubmit.migrate(args.expid, args.offer, args.pickup, args.onlyremote) elif args.command == 'create': return Autosubmit.create(args.expid, args.noplot, args.hide, args.output, args.group_by, args.expand, - args.expand_status, args.notransitive, args.check_wrapper, args.detail) + args.expand_status, args.notransitive, args.check_wrapper, args.detail, args.profile) elif args.command == 'configure': if not args.advanced or (args.advanced and dialog is None): return Autosubmit.configure(args.advanced, args.databasepath, args.databasefilename, @@ -2016,6 +2021,11 @@ class Autosubmit: :return: None """ + # Start profiling if the flag has been used + if profile: + profiler = Profiler(expid) + profiler.start() + # Initialize common folders try: exp_path = os.path.join(BasicConfig.LOCAL_ROOT_DIR, expid) @@ -2023,11 +2033,6 @@ class Autosubmit: except BaseException as e: raise AutosubmitCritical("Failure during the loading of the experiment configuration, check file paths", 7014, str(e)) - - # If the profile flag has been used, activate the profiler and start taking measures - if profile: - profiler = Profiler(expid) - profiler.start() # checking if there is a lock file to avoid multiple running on the same expid try: @@ -2393,7 +2398,7 @@ class Autosubmit: @staticmethod def monitor(expid, file_format, lst, filter_chunks, filter_status, filter_section, hide, txt_only=False, group_by=None, expand="", expand_status=list(), hide_groups=False, notransitive=False, - check_wrapper=False, txt_logfiles=False, detail=False): + check_wrapper=False, txt_logfiles=False, profile=False, detail=False): """ Plots workflow graph for a given experiment with status of each job coded by node color. Plot is created in experiment's plot folder with name __