https://dagster.io/ logo
Title
m

Maitiú Ó Ciaráin

06/23/2021, 8:52 AM
Hi dagsteristas, I'm using dagstermill to execute a notebook and would like to implement some retry logic. I'm raising a
RetryRequested
but I think papermill is catching the exception and wrapping it, leading to a general failure of the pipeline. Based on the examples and docs I think just raising a
RetryRequested
is the correct approach but I have probably missed something. Stacktrace:
dagster.core.errors.DagsterExecutionStepExecutionError: Error occurred while executing solid "qa__master_old":
  File "/opt/conda/envs/dagster-pipeline/lib/python3.8/site-packages/dagster/core/execution/plan/execute_plan.py", line 193, in _dagster_event_sequence_for_step
    for step_event in check.generator(step_events):
  File "/opt/conda/envs/dagster-pipeline/lib/python3.8/site-packages/dagster/core/execution/plan/execute_step.py", line 308, in core_dagster_event_sequence_for_step
    for user_event in check.generator(
  File "/opt/conda/envs/dagster-pipeline/lib/python3.8/site-packages/dagster/core/execution/plan/execute_step.py", line 63, in _step_output_error_checked_user_event_sequence
    for user_event in user_event_sequence:
  File "/opt/conda/envs/dagster-pipeline/lib/python3.8/site-packages/dagster/core/execution/plan/compute.py", line 138, in execute_core_compute
    for step_output in _yield_compute_results(step_context, inputs, compute_fn):
  File "/opt/conda/envs/dagster-pipeline/lib/python3.8/site-packages/dagster/core/execution/plan/compute.py", line 111, in _yield_compute_results
    for event in iterate_with_context(
  File "/opt/conda/envs/dagster-pipeline/lib/python3.8/site-packages/dagster/utils/__init__.py", line 384, in iterate_with_context
    return
  File "/opt/conda/envs/dagster-pipeline/lib/python3.8/contextlib.py", line 131, in __exit__
    self.gen.throw(type, value, traceback)
  File "/opt/conda/envs/dagster-pipeline/lib/python3.8/site-packages/dagster/core/execution/plan/utils.py", line 62, in solid_execution_error_boundary
    raise error_cls(


The above exception was caused by the following exception:
papermill.exceptions.PapermillExecutionError:

---------------------------------------------------------------------------
Exception encountered at "In [13]":
---------------------------------------------------------------------------
RetryRequested Traceback (most recent call last)
<ipython-input-13-cd6a6478a462> in <module>
20 pass
21 else:
---> 22 raise RetryRequested(max_retries=60, seconds_to_wait=10*60)
23
24 if last_metric_date_without_LI != expected_last_metric_date:

RetryRequested:

  File "/opt/conda/envs/dagster-pipeline/lib/python3.8/site-packages/dagster/core/execution/plan/utils.py", line 42, in solid_execution_error_boundary
    yield
  File "/opt/conda/envs/dagster-pipeline/lib/python3.8/site-packages/dagster/utils/__init__.py", line 382, in iterate_with_context
    next_output = next(iterator)
  File "/opt/conda/envs/dagster-pipeline/lib/python3.8/site-packages/dagstermill/solids.py", line 192, in _t_fn
    papermill.execute_notebook(
  File "/opt/conda/envs/dagster-pipeline/lib/python3.8/site-packages/papermill/execute.py", line 122, in execute_notebook
    raise_for_execution_errors(nb, output_path)
  File "/opt/conda/envs/dagster-pipeline/lib/python3.8/site-packages/papermill/execute.py", line 234, in raise_for_execution_errors
raise error
a

alex

06/23/2021, 5:56 PM
what version are you on? the error should communicate that you are supposed to use
dagstermill.yield_event
https://dagster.phacility.com/D7406 for context
👍 1
m

Maitiú Ó Ciaráin

06/23/2021, 8:06 PM
0.11.14
but that makes sense. I was following the example in
python_modules/libraries/dagstermill/dagstermill/examples/notebooks/raise_retry.ipynb
FYI.
Thanks
To follow up on this, using
yield_event
does indeed lead to a retry being requested but the solid generated by dagstermill ( define_dagstermill_solid) doesn't allow for retries. I think this could be enabled by adding a
retry_policy: (Optional[RetryPolicy])
kwarg to
define_dagstermill_solid()
and then pasisng that to the resulting
SolidDefinition
.
a

alex

06/24/2021, 2:38 PM
Hm - you shouldn’t need a retry policy if you are using yield event. The policy just takes care of throwing the request for you. Can you file an issue with some more details of exactly what you are doing and seeing ?
m

Maitiú Ó Ciaráin

06/28/2021, 1:06 PM
I ran some tests on this over the weekend and something else was going on. Thanks