Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
intermediate_path = os.path.join(
output_notebook_dir, '{prefix}-inter.ipynb'.format(prefix=str(uuid.uuid4()))
)
write_ipynb(nb_no_parameters, intermediate_path)
with user_code_error_boundary(
DagstermillExecutionError,
lambda: (
'Error occurred during the execution of Dagstermill solid '
'{solid_name}: {notebook_path}'.format(
solid_name=name, notebook_path=notebook_path
)
),
):
try:
papermill_engines.register('dagstermill', DagstermillNBConvertEngine)
papermill.execute_notebook(
intermediate_path, temp_path, engine_name='dagstermill', log_output=True
)
except Exception as exc:
yield Materialization(
label='output_notebook',
description='Location of output notebook on the filesystem',
metadata_entries=[EventMetadataEntry.fspath(temp_path)],
)
raise exc
# deferred import for perf
import scrapbook
output_nb = scrapbook.read_notebook(temp_path)