Skip to content

Commit

Permalink
Making command line optional (for sos notebook) #975
Browse files Browse the repository at this point in the history
  • Loading branch information
Bo Peng committed Jun 4, 2018
1 parent b514352 commit db010af
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 8 deletions.
15 changes: 7 additions & 8 deletions src/sos/report.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,38 +40,38 @@ def master_id(self):
return list(self.data['workflow_subworkflows'].keys())[0]
except Exception as e:
env.logger.warning(f'Failed to obtain master id: {e}')
return 'NA'
return ''

def workflow_name(self, id):
try:
return self.data['workflow_name'][id][0]
except Exception as e:
env.logger.warning(f'Failed to obtain workflow_name for {id}: {e}')
return 'NA'
return ''

def workflow_start_time(self, id):
try:
return time.strftime('%Y-%m-%d %H:%M:%S',
time.localtime(float(self.data['workflow_start_time'][id][0])))
except Exception as e:
env.logger.warning(f'Failed to obtain workflow_start_time {id}: {e}')
return 'NA'
return ''

def workflow_end_time(self, id):
try:
return time.strftime('%Y-%m-%d %H:%M:%S',
time.localtime(float(self.data['workflow_end_time'][id][0])))
except Exception as e:
env.logger.warning(f'Failed to obtain workflow_end_time {id}: {e}')
return 'NA'
return ''

def workflow_duration(self, id):
try:
return format_duration(int(float(self.data['workflow_end_time'][id][0])
- float(self.data['workflow_start_time'][id][0])))
except Exception as e:
env.logger.warning(f'Failed to obtain workflow duration {id}: {e}')
return 'NA'
return ''

def workflow_stat(self, id):
try:
Expand All @@ -85,14 +85,13 @@ def workflow_subworkflows(self, id):
return self.data['workflow_subworkflows'][id]
except Exception as e:
env.logger.warning(f'Failed to obtain workflow_subworkflows {id}: {e}')
return 'NA'
return ''

def workflow_command_line(self, id):
try:
return self.data['workflow_command_line'][id][0]
except Exception as e:
env.logger.warning(f'Failed to obtain command line {id}: {e}')
return 'NA'
return ''

def tasks(self):
try:
Expand Down
2 changes: 2 additions & 0 deletions src/sos/templates/workflow_report.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,11 @@
<h1>SoS Workflow Report</h1>

<table class='info_table'>
{% if workflow_cmd %}
<tr>
<th> Command Line</th><td><code>{{workflow_cmd}}</code></td>
</tr>
{% endif %}
<tr>
<th> Worklow Name</th><td>{{workflow_name}}</td>
</tr>
Expand Down

0 comments on commit db010af

Please sign in to comment.