Open Byloth opened 2 years ago
This issue originated from Issue #7646.
Hi Byloth.
I was able to get the job to run by slightly changing the run_config to the following:
config = {
"inputs": {
"number": None
}
}
Would that work for you?
I think in an ideal world, the Optional[T] would accept None
values in the scalar union value
.
The default Int
/ String
/ etc scalar union values either accept the raw value, or a dict that specifies the value either directly or via json/pickle.
To support this fully, we would need to plumb the "optional" part through the ScalarUnion all the way through to the base builtin type support.
Hi, @prha!
Sorry for my late reply.
Yes... It works.
But, actually, it was a simplified version of a more complex problem.
In my case, what I represent as "inputs": { "numbers": None }
, is the output from another solid causing it to throw the same error.
I think the solution should be achieved as you described in your second comment.
Just so that I can figure out the severity of the problem, do you have an example of something not using input config where this is causing problems? I'm somewhat surprised that we'd hit issues from Optional
outputs of solids triggering this type of error.
For example, in the below simple job, the upstream solid can return an int
or None
and the job will execute fine.
@op
def upstream() -> Optional[Int]:
return None
@op
def downstream(context, num: Optional[Int]) -> Optional[Int]:
context.log.info(f'num is {num}, {type(num)}')
@job
def prha_job():
downstream(upstream())
Summary
I was using the new
op
/graph
APIs, was testing out the Dagster's behaviour with some edge-cases related toOptional
types.Going into detail, I've defined both a
graph
and anop
with anOptional[Int]
parameter as input.I tried passing an
Int
input to thisgraph
and it works fine.Then, I tried passing a
None
value to the samegraph
and it throws an error.Reproduction
Here's the code I used:
Message from the maintainers:
Impacted by this bug? Give it a 👍. We factor engagement into prioritization.