From 767abfa5db1934de1b5767373b58fcfb3dd5943f Mon Sep 17 00:00:00 2001 From: MishaZakharchanka Date: Wed, 2 Aug 2023 14:52:38 -0700 Subject: [PATCH 1/4] Adding option to skip noteEnd --- ats/atsMachines/lsf_asq.py | 1 + ats/atsMachines/slurmProcessorScheduled.py | 1 + ats/configuration.py | 3 +++ ats/machines.py | 3 ++- 4 files changed, 7 insertions(+), 1 deletion(-) diff --git a/ats/atsMachines/lsf_asq.py b/ats/atsMachines/lsf_asq.py index 8a050ea..540610c 100644 --- a/ats/atsMachines/lsf_asq.py +++ b/ats/atsMachines/lsf_asq.py @@ -212,6 +212,7 @@ def examineOptions(self, options): print("%s options.nosrun = %s " % (DEBUG_LSF, options.nosrun)) print("%s options.checkForAtsProc = %s " % (DEBUG_LSF, options.checkForAtsProc)) print("%s options.showGroupStartOnly = %s " % (DEBUG_LSF, options.showGroupStartOnly)) + print("%s options.removeEndNote = %s " % (DEBUG_LSF, options.removeEndNote)) print("%s options.skip = %s " % (DEBUG_LSF, options.skip)) print("%s options.blueos_exclusive = %s " % (DEBUG_LSF, options.blueos_exclusive)) print("%s options.mpibind = %s " % (DEBUG_LSF, options.mpibind)) diff --git a/ats/atsMachines/slurmProcessorScheduled.py b/ats/atsMachines/slurmProcessorScheduled.py index b9ea520..b8da670 100644 --- a/ats/atsMachines/slurmProcessorScheduled.py +++ b/ats/atsMachines/slurmProcessorScheduled.py @@ -169,6 +169,7 @@ def examineOptions(self, options): print("%s options.salloc = %s " % (DEBUG_SLURM, options.salloc)) print("%s options.checkForAtsProc = %s " % (DEBUG_SLURM, options.checkForAtsProc)) print("%s options.showGroupStartOnly = %s " % (DEBUG_SLURM, options.showGroupStartOnly)) + print("%s options.removeEndNote = %s " % (DEBUG_SLURM, options.removeEndNote)) print("%s options.skip = %s " % (DEBUG_SLURM, options.skip)) print("%s options.exclusive = %s " % (DEBUG_SLURM, options.exclusive)) print("%s options.mpibind = %s " % (DEBUG_SLURM, options.mpibind)) diff --git a/ats/configuration.py b/ats/configuration.py index 0f47af2..95f5bf6 100644 --- a/ats/configuration.py +++ b/ats/configuration.py @@ -380,6 +380,9 @@ def add_more_options(parser): parser.add_option('--showGroupStartOnly', action='store_true', help='''Only show start of first test in group, not subsequent steps.''') + parser.add_option('--removeEndNote', action='store_true', + help='''Remove message printed after test has finished + running.''') parser.add_option('--skip', action='store_true', help='''skip actual execution of the tests, but show filtering results and missing test files.''') diff --git a/ats/machines.py b/ats/machines.py index d479dca..374ea66 100644 --- a/ats/machines.py +++ b/ats/machines.py @@ -317,7 +317,8 @@ def testEnded(self, test, status): #note test.status is not necessarily status after this! #see test.expectedResult - self.noteEnd(test) #to be defined in children + if not configuration.options.removeEndNote: + self.noteEnd(test) #to be defined in children # now close the outputs if test.stdOutLocGet() != 'terminal': From 4d5e5d73f2342fdb890f31b9349657891bd25694 Mon Sep 17 00:00:00 2001 From: MishaZakharchanka Date: Thu, 3 Aug 2023 14:18:38 -0700 Subject: [PATCH 2/4] Adding option to skip logStart --- ats/atsMachines/lsf_asq.py | 1 + ats/atsMachines/slurmProcessorScheduled.py | 1 + ats/configuration.py | 5 ++++- ats/schedulers.py | 3 ++- 4 files changed, 8 insertions(+), 2 deletions(-) diff --git a/ats/atsMachines/lsf_asq.py b/ats/atsMachines/lsf_asq.py index 540610c..5aab1b2 100644 --- a/ats/atsMachines/lsf_asq.py +++ b/ats/atsMachines/lsf_asq.py @@ -212,6 +212,7 @@ def examineOptions(self, options): print("%s options.nosrun = %s " % (DEBUG_LSF, options.nosrun)) print("%s options.checkForAtsProc = %s " % (DEBUG_LSF, options.checkForAtsProc)) print("%s options.showGroupStartOnly = %s " % (DEBUG_LSF, options.showGroupStartOnly)) + print("%s options.removeStartNote = %s " % (DEBUG_LSF, options.removeStartNote)) print("%s options.removeEndNote = %s " % (DEBUG_LSF, options.removeEndNote)) print("%s options.skip = %s " % (DEBUG_LSF, options.skip)) print("%s options.blueos_exclusive = %s " % (DEBUG_LSF, options.blueos_exclusive)) diff --git a/ats/atsMachines/slurmProcessorScheduled.py b/ats/atsMachines/slurmProcessorScheduled.py index b8da670..d0e83b2 100644 --- a/ats/atsMachines/slurmProcessorScheduled.py +++ b/ats/atsMachines/slurmProcessorScheduled.py @@ -169,6 +169,7 @@ def examineOptions(self, options): print("%s options.salloc = %s " % (DEBUG_SLURM, options.salloc)) print("%s options.checkForAtsProc = %s " % (DEBUG_SLURM, options.checkForAtsProc)) print("%s options.showGroupStartOnly = %s " % (DEBUG_SLURM, options.showGroupStartOnly)) + print("%s options.removeStartNote = %s " % (DEBUG_SLURM, options.removeStartNote)) print("%s options.removeEndNote = %s " % (DEBUG_SLURM, options.removeEndNote)) print("%s options.skip = %s " % (DEBUG_SLURM, options.skip)) print("%s options.exclusive = %s " % (DEBUG_SLURM, options.exclusive)) diff --git a/ats/configuration.py b/ats/configuration.py index 95f5bf6..833b38c 100644 --- a/ats/configuration.py +++ b/ats/configuration.py @@ -380,8 +380,11 @@ def add_more_options(parser): parser.add_option('--showGroupStartOnly', action='store_true', help='''Only show start of first test in group, not subsequent steps.''') + parser.add_option('--removeStartNote', action='store_true', + help='''Remove message printed before the test has started + running.''') parser.add_option('--removeEndNote', action='store_true', - help='''Remove message printed after test has finished + help='''Remove message printed after the test has finished running.''') parser.add_option('--skip', action='store_true', help='''skip actual execution of the tests, but show diff --git a/ats/schedulers.py b/ats/schedulers.py index e8d0e9d..73207e6 100644 --- a/ats/schedulers.py +++ b/ats/schedulers.py @@ -81,7 +81,8 @@ def step(self): self.schedule("Chose #%d to start." % nextTest.serialNumber) self.addBlock(nextTest) result = machine.startRun(nextTest) - self.logStart(nextTest, result) + if not configuration.options.removeStartNote: + self.logStart(nextTest, result) if not result: self.removeBlock(nextTest) break # failure to launch, let it come back if tests left. From 8edf932925470163a065fccd5f073c8b8029d5d2 Mon Sep 17 00:00:00 2001 From: MishaZakharchanka Date: Tue, 8 Aug 2023 12:42:49 -0700 Subject: [PATCH 3/4] Moving print to a return to allow noteEnd to be called always --- ats/atsMachines/lsf_asq.py | 3 ++- ats/atsMachines/slurmProcessorScheduled.py | 3 ++- ats/machines.py | 4 +++- 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/ats/atsMachines/lsf_asq.py b/ats/atsMachines/lsf_asq.py index 5aab1b2..d903b20 100644 --- a/ats/atsMachines/lsf_asq.py +++ b/ats/atsMachines/lsf_asq.py @@ -849,7 +849,7 @@ def noteEnd(self, test): if my_environment == "INTERACTIVE": os.system("stty sane") # Keep the interactive terminal sane on blueos - print(msg) + # print(msg) if my_environment == "INTERACTIVE": os.system("stty sane") # Keep the interactive terminal sane on blueos @@ -883,6 +883,7 @@ def noteEnd(self, test): print("ATS Error: Can not find file '%s'\n" % test.rs_filename) #print self.nodesInUse + return msg def periodicReport(self): "Report on current status of tasks" diff --git a/ats/atsMachines/slurmProcessorScheduled.py b/ats/atsMachines/slurmProcessorScheduled.py index d0e83b2..2522cf5 100644 --- a/ats/atsMachines/slurmProcessorScheduled.py +++ b/ats/atsMachines/slurmProcessorScheduled.py @@ -650,7 +650,8 @@ def noteEnd(self, test): msg = '%s #%4d %s, nn=%d, np=%d, nt=%d, ngpu=0 %s' % \ ("Stop ", test.serialNumber, test.name, my_nn, my_np, my_nt, time.asctime()) - print(msg) + # print(msg) + return msg def periodicReport(self): "Report on current status of tasks" diff --git a/ats/machines.py b/ats/machines.py index 374ea66..ac191a6 100644 --- a/ats/machines.py +++ b/ats/machines.py @@ -317,8 +317,10 @@ def testEnded(self, test, status): #note test.status is not necessarily status after this! #see test.expectedResult + endNote = self.noteEnd(test) #to be defined in children + if not configuration.options.removeEndNote: - self.noteEnd(test) #to be defined in children + print(endNote) # now close the outputs if test.stdOutLocGet() != 'terminal': From 9a224456477de14d5d51bf408a78257667ce0475 Mon Sep 17 00:00:00 2001 From: MishaZakharchanka Date: Tue, 8 Aug 2023 14:18:56 -0700 Subject: [PATCH 4/4] Adding print end msg for fluxx --- ats/atsMachines/fluxScheduled.py | 5 +++++ ats/atsMachines/lsf_asq.py | 2 -- ats/atsMachines/slurmProcessorScheduled.py | 1 - ats/machines.py | 5 +++-- 4 files changed, 8 insertions(+), 5 deletions(-) diff --git a/ats/atsMachines/fluxScheduled.py b/ats/atsMachines/fluxScheduled.py index ff30ebc..2601cb9 100755 --- a/ats/atsMachines/fluxScheduled.py +++ b/ats/atsMachines/fluxScheduled.py @@ -428,6 +428,11 @@ def noteEnd(self, test): test.num_nodes, test.np, test.cpus_per_task, test.gpus_per_task, test.num_nodes)), echo=True) + msg = '%s #%4d %s, nn=%d, np=%d, ngpu=%d %s' % \ + ("Stop ", test.serialNumber, test.name, test.num_nodes, test.np, test.gpus_per_task, time.asctime()) + + return msg + def periodicReport(self): """ Report on current status of tasks and processor availability. diff --git a/ats/atsMachines/lsf_asq.py b/ats/atsMachines/lsf_asq.py index d903b20..5fcb3be 100644 --- a/ats/atsMachines/lsf_asq.py +++ b/ats/atsMachines/lsf_asq.py @@ -849,8 +849,6 @@ def noteEnd(self, test): if my_environment == "INTERACTIVE": os.system("stty sane") # Keep the interactive terminal sane on blueos - # print(msg) - if my_environment == "INTERACTIVE": os.system("stty sane") # Keep the interactive terminal sane on blueos diff --git a/ats/atsMachines/slurmProcessorScheduled.py b/ats/atsMachines/slurmProcessorScheduled.py index 2522cf5..8d2495a 100644 --- a/ats/atsMachines/slurmProcessorScheduled.py +++ b/ats/atsMachines/slurmProcessorScheduled.py @@ -650,7 +650,6 @@ def noteEnd(self, test): msg = '%s #%4d %s, nn=%d, np=%d, nt=%d, ngpu=0 %s' % \ ("Stop ", test.serialNumber, test.name, my_nn, my_np, my_nt, time.asctime()) - # print(msg) return msg def periodicReport(self): diff --git a/ats/machines.py b/ats/machines.py index ac191a6..77fd90a 100644 --- a/ats/machines.py +++ b/ats/machines.py @@ -319,8 +319,9 @@ def testEnded(self, test, status): endNote = self.noteEnd(test) #to be defined in children - if not configuration.options.removeEndNote: - print(endNote) + if endNote: # Check that there is something to be printed + if not configuration.options.removeEndNote: # Does the user want it to be printed + print(endNote) # now close the outputs if test.stdOutLocGet() != 'terminal':