dagster icon indicating copy to clipboard operation
dagster copied to clipboard

[docs] - Consider removing `yield` logic from sensor evaluation function examples

Open dagsterbot[bot] opened this issue 3 years ago • 0 comments

Issue from the Dagster Slack

Consider removing yield logic from sensor evaluation function examples

This issue was generated from the slack conversation at: https://dagster.slack.com/archives/C01U954MEER/p1627687647038100?thread_ts=1627687647.038100&cid=C01U954MEER

Conversation excerpt:

U01VAFX0APR: Hi team. I was wondering if you could help me with two questions. I am working whit the sensors. I upgrade Dagster version to 0.12.4. I am trying to return a SkipReason when the file I am pointing doesn't have new modifications. Here my sensor: I am getting this error (Is this the expected behavior?). Also, I would like to know how can I set the mode dependently in which environment I am working? (could be it configured using the GUI?) Thanks in advance.

  • Link to image of code
  • Link to image of error:
    dagster.check.CheckError: Member of list mismatches type. Expected <class 
    'dagster.core.definitions.run_request.PipelineRunReaction'>. Got 
    SkipReason(skip_message='There is not new changes in <file_path>.') of 
    type <class 'dagster.core.definitions.run_request.SkipReason'>.
    
  • Link to image of Dagit

UM49TQ8EB: Hi <@U01VAFX0APR>!

I think you’re hitting this error because you’re yielding both a SkipReason AND a RunRequest. I think you probably want this instead:

if file_mtime &lt;= last_mtime:
    return SkipReason(f"There is not new changes in {directory}.")
else:
    # some logic
    return RunRequest(run_key=run_key, run_config=run_config)

UM49TQ8EB: I think we should probably clean up our sensor APIs to just return objects instead of yielding, especially since we’re not streaming run requests UM49TQ8EB: <@U018K0G2Y85> issue Consider removing yield logic from sensor evaluation function examples


Message from the maintainers:

Are you looking for the same documentation content? Give it a :thumbsup:. We factor engagement into prioritization.

dagsterbot[bot] avatar Jul 31 '21 00:07 dagsterbot[bot]