https://dagster.io/ logo
#dagster-support
Title
# dagster-support
t

Thomas

12/14/2022, 4:01 PM
The code in the snippet below comes from the documentation: https://docs.dagster.io/concepts/types#defining-a-dagster-type. However it does not work and returns the error below. Is this a problem on my end or in the documentation?
Copy code
Traceback (most recent call last):
  File "/Users/thomas/miniforge3/envs/datagenerator/lib/python3.10/site-packages/IPython/core/interactiveshell.py", line 3433, in run_code
    exec(code_obj, self.user_global_ns, self.user_ns)
  File "<ipython-input-22-26c8dc208c5a>", line 10, in <module>
    ins={"num": In(EvenDagsterType)},
TypeError: 'list' object is not callable
j

jamie

12/14/2022, 8:32 PM
hi @Thomas I will check this in a minute (hopping in a meeting right now), but could you try removing the comma from the end of the lambda function? so it would be `
Copy code
lambda _, value: isinstance(value, int) and value % 2 == 0
t

Thomas

12/15/2022, 8:23 AM
Hi @jamie thanks, unfortunately it did not change the error code. Did you find anything else? Thanks!
j

jamie

12/15/2022, 3:51 PM
not yet. i have a bit of time right now, so i’m going to try to replicate this
hmmm it works for me. here’s what i’m doing
Copy code
from dagster import op, DagsterType, In, Out, job, repository

EvenDagsterType = DagsterType(
    name="EvenDagsterType",
    type_check_fn=lambda _, value: isinstance(value, int) and value % 2 == 0,
)

@op
def two():
    return 2

@op(
    ins={"num": In(EvenDagsterType)},
    out=Out(EvenDagsterType),
)
def double_even(num):
    return num


@job
def my_job():
    double_even(two())

@repository
def my_repo():
    return [my_job]
and then loading up dagit and running the job from there. I’m also running latest version of dagster
❤️ 1
t

Thomas

12/21/2022, 12:47 PM
Thank you for the help!
2 Views