Skip to content

Commit

Permalink
Improve the prints from launch experiment script (#128)
Browse files Browse the repository at this point in the history
* Improve the prints from launch experiment script

* fix coding norms

Co-authored-by: danholdaway <[email protected]>
  • Loading branch information
danholdaway and danholdaway authored Nov 3, 2022
1 parent 7a8e2b0 commit 40f8294
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 11 deletions.
26 changes: 16 additions & 10 deletions src/swell/deployment/bin/swell_launch_experiment.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,6 @@ def cylc_run_experiment(self): # NB: Could be a factory based on workflow_manag
os.environ['CYLC_CONF_PATH'] = self.suite_path

# Install the suite

if self.log_path:
# Add optional path for workflow engine logging.
option = '--symlink-dirs=run=' + self.log_path
Expand All @@ -70,22 +69,28 @@ def cylc_run_experiment(self): # NB: Could be a factory based on workflow_manag
subprocess.run(['cylc', 'play', self.experiment_name], check=True)

# Pre TUI messages
self.logger.info(' ')
self.logger.info(' ', False)
self.logger.info('Workflow is now running... ')
self.logger.info(' ')
self.logger.info('Use \'cylc scan\' to see running workflows.')
self.logger.info(' ')
self.logger.info(' ', False)
self.logger.info('Use \'\u001b[32mcylc scan\033[0m\' to see running workflows.')
self.logger.info(' ', False)
self.logger.info('If the workflow needs to be stopped, close the TUI (if open)')
self.logger.info('by pressing \'q\' and issue either:')
self.logger.info(' cylc stop ' + self.experiment_name)
self.logger.info(' ', False)
self.logger.info(' \u001b[32mcylc stop ' + self.experiment_name + '\033[0m')
self.logger.info(' ', False)
self.logger.info('or to kill running tasks and stop:')
self.logger.info(' cylc stop --kill ' + self.experiment_name)
self.logger.info(' ')
self.logger.info(' ', False)
self.logger.info(' \u001b[32mcylc stop --kill ' + self.experiment_name + '\033[0m')
self.logger.info(' ', False)

# Launch the job monitor
self.logger.input('Launching the TUI, press \'q\' at any time to exit the TUI')
self.logger.info(' ', False)
self.logger.info('TUI can be relaunched with:')
self.logger.info(' cylc tui ' + self.experiment_name)
self.logger.info(' ', False)
self.logger.info(' \u001b[32mcylc tui ' + self.experiment_name + '\033[0m')
self.logger.info(' ', False)
subprocess.run(['cylc', 'tui', self.experiment_name], check=True)

# --------------------------------------------------------------------------------------------------
Expand Down Expand Up @@ -123,7 +128,8 @@ def main(suite_path, workflow_manager, no_detach, log_path):

# Write some info for the user
# ----------------------------
deploy_workflow.logger.info('Launching workflow defined by files in ' + suite_path + '``.')
deploy_workflow.logger.info('Launching workflow defined by files in \'' + suite_path + '\'.',
False)
deploy_workflow.logger.info('Experiment name: ' + experiment_name)
deploy_workflow.logger.info('Workflow manager: ' + workflow_manager)

Expand Down
2 changes: 1 addition & 1 deletion src/swell/utilities/logger.py
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,6 @@ def assert_abort(self, condition, message, wrap=True):

def input(self, message):

input('INPUT '+self.task_name+': '+message + ". Press any key to continue...")
input(' '+self.task_name+': '+message + ". Press any key to continue...")

# ----------------------------------------------------------------------------------------------

0 comments on commit 40f8294

Please sign in to comment.