aws / aws/amazon-sagemaker-examples
[StepFunctions list_events(html=True) errors out]
- Dominant language
- Jupyter Notebook
- Stars
- 11k
- Forks
- 7k
- Avg merge
- 8h 29m
- Merged PRs (30d)
- 8
Description
**Link to the notebook**
https://github.com/aws/amazon-sagemaker-examples/blob/master/step-functions-data-science-sdk/machine_learning_workflow_abalone/machine_learning_workflow_abalone.ipynb
**Describe the bug**
`execution.list_events(html=True)`
results in the following error:
```
---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
in
----> 1 execution.list_events(html=True)
~/anaconda3/envs/python3/lib/python3.6/site-packages/stepfunctions/workflow/stepfunctions.py in list_events(self, max_items, reverse_order, html)
487
488 if html:
--> 489 return HTML(events_list.to_html())
490 else:
491 return events_list
~/anaconda3/envs/python3/lib/python3.6/site-packages/stepfunctions/workflow/stepfunctions.py in to_html(self)
45
46 def to_html(self):
---> 47 return EventsTableWidget(self).show()
48
49
~/anaconda3/envs/python3/lib/python3.6/site-packages/stepfunctions/workflow/widgets/events_table.py in __init__(self, events)
141 timestamp=format_time(event.get("timestamp")),
142 event_detail=self._format_event_detail(event)
--> 143 ) for event in events]
144
145 self.template = Template(TABLE_TEMPLATE.format(table_rows='\n'.join(table_rows)))
~/anaconda3/envs/python3/lib/python3.6/site-packages/stepfunctions/workflow/widgets/events_table.py in (.0)
141 timestamp=format_time(event.get("timestamp")),
142 event_detail=self._format_event_detail(event)
--> 143 ) for event in events]
144
145 self.template = Template(TABLE_TEMPLATE.format(table_rows='\n'.join(table_rows)))
~/anaconda3/envs/python3/lib/python3.6/site-packages/stepfunctions/workflow/widgets/events_table.py in _format_event_detail(self, event)
307 def _format_event_detail(self, event):
308 event_details = self._get_step_detail(event)
--> 309 self._unpack_to_proper_dict(event_details)
310 return json.dumps(event_details, indent=4)
311
~/anaconda3/envs/python3/lib/python3.6/site-packages/stepfunctions/workflow/widgets/events_table.py in _unpack_to_proper_dict(self, dictionary)
313 for k, v in dictionary.items():
314 if isinstance(v, dict):
--> 315 self._unpack_to_proper_dict(v)
316 else:
317 dictionary[k] = self._load_json(v)
~/anaconda3/envs/python3/lib/python3.6/site-packages/stepfunctions/workflow/widgets/events_table.py in _unpack_to_proper_dict(self, dictionary)
315 self._unpack_to_proper_dict(v)
316 else:
--> 317 dictionary[k] = self._load_json(v)
318
319 def _load_json(self, value):
~/anaconda3/envs/python3/lib/python3.6/site-packages/stepfunctions/workflow/widgets/events_table.py in _load_json(self, value)
319 def _load_json(self, value):
320 try:
--> 321 return json.loads(value)
322 except ValueError as e:
323 return value
~/anaconda3/envs/python3/lib/python3.6/json/__init__.py in loads(s, encoding, cls, object_hook, parse_float, parse_int, parse_constant, object_pairs_hook, **kw)
346 if not isinstance(s, (bytes, bytearray)):
347 raise TypeError('the JSON object must be str, bytes or bytearray, '
--> 348 'not {!r}'.format(s.__class__.__name__))
349 s = s.decode(detect_encoding(s), 'surrogatepass')
350
TypeError: the JSON object must be str, bytes or bytearray, not 'bool'
```
**To Reproduce**
Launch notebook in SageMaker Classic Environment. Select "conda_python3" kernel. Edit/create IAM role as prescribed. Run All
Contributor guide
Research direction
Start with the linked machine_learning_workflow_abalone.ipynb notebook and trace execution.list_events(html=True) into workflow/widgets/events_table.py, especially _format_event_detail and _load_json. Reproduce the failure in the conda_python3 kernel, then verify that the HTML event table renders successfully without the reported TypeError.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- aws, jupyter-notebook, python
- Domain
- machine-learning
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100