question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Solids are skipped when their optional inputs are skipped

See original GitHub issue

Given a “fan in” solid with N fans, if one of the N fans is an input from an upstream solid that gets skipped, the fan in solid gets skipped too, even though that skipped input was marked as Optional.

    A
   / \
  B   C
   \ /
    D
    |
    E

D defines the input from C as optional, but if C is skipped then D and E won’t run run.

Some code to show how this issue is biting us in real life:

def construct_fan_in_solid(fan_count):

    assert fan_count > 1

    solid_name = f'fan_in_{fan_count}'

    input_defs = [ InputDefinition('fan_1', Any) ]
    for fan_id in range(2, fan_count + 1):
        input_defs.append(InputDefinition(f'fan_{fan_id}', Optional[Any], default_value=None))

    def _fan_in(context, *fans):
        yield Output(fans[0], 'fan_1')

    return SolidDefinition(
        name=solid_name,
        input_defs=input_defs,
        output_defs=[
            OutputDefinition(name='fan_1', dagster_type=Any)
        ],
        compute_fn=_fan_in,
    )

fan_in_11 = construct_fan_in_solid(11)

(Aside: I created this solid using a factory because of #1817. First attempt used a List, but it wasn’t clear if the problem was the issue described here or if Dagster was misunderstanding what Optional[List[Optional[Any]]] means.)

Dagit correctly recognizes that all fans except the first are optional:

fanin

The above is used like this:

@pipeline
def my_pipeline():
    main_id, other_id = solid2(solid1()) # other_id is an optional output
    fan1 = solid3(main_id)
    fan2 = solid4(other_id)
    ...
    main_id = fan_in_11(main_id, fan1, fan2, ...)
    solid5(main_id)

The problem: if other_id is not outputted by solid2, fan_in_11 doesn’t run because Dagster complains its dependencies (fan2 from solid4) didn’t produce an output - despite their being marked optional inputs.

Dagster v0.8.5

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:1
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

3reactions
alangenfeldcommented, Jul 8, 2020

Working on a fix for how the skipping behavior proceeds through fan-in dependencies https://dagster.phacility.com/D3767, hoping to have it in for the weekly release.

Note that the Optional typing for inputs, follows the python type meaning of Union[X, None] https://docs.python.org/3/library/typing.html#typing.Optional so just specifies that None is an acceptable value as opposed to interacting with the skipping behavior of is_required=False outputs. That said, the fact this is so confusing is noted and we are thinking of how we can improve.

1reaction
alangenfeldcommented, Jul 13, 2020

I think we can close this one.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Optional Arguments - The R Book [Book]
Optional Arguments Here is a function called charplot that produces a scatterplot of x and y using solid red circles as the plotting...
Read more >
How does node.js handle skipped optional arguments
What happens if I skip an optional argument in node.js. I have the following code: //server.mjs import { exec } from 'child_process'; ...
Read more >
Optional Arguments
A keyword is required for an argument only if a preceding optional argument is omitted or if the argument sequence is changed.
Read more >
Why Users Fill Out Less If You Mark Required Fields
However, when you mark a form's required fields, it jeopardizes voluntary over-disclosure and makes users skip optional fields. Marking required ...
Read more >
Reducing Calldata Size with Optional/Default Function ...
I'd like to discuss the possibility of native support for optional and/or default parameters on public functions in Solidity.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found