The Wayback Machine - https://web.archive.org/web/20210816013111/https://github.com/dagster-io/dagster/issues/4198
Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use pipeline docstrings as descriptions #4198

Open
abkfenris opened this issue May 21, 2021 · 2 comments
Open

Use pipeline docstrings as descriptions #4198

abkfenris opened this issue May 21, 2021 · 2 comments

Comments

@abkfenris
Copy link

@abkfenris abkfenris commented May 21, 2021

Use Case

Currently to populate the description of a @pipeline(), you have to specify the description in decorator keyword arguments.

@pipeline(
   description="Download, process, and transform HYCOM data for a date"
)
def daily_hycom_download():
    date = input_date()
    hycom_ds_for_date(date)

This differs from @solid(), which will use the functions docstring for a description, if a description keyword argument is not specified.

@solid(config_schema={"date": str})
def input_date(context,) -> str:
    """ Return a a YYYY-MM-DD string from the context """

    return context.solid_config["date"]

It would be nice to have the interfaces to the common decorators be similar, and using the docstring for the description, keeps relevant function information where a Python programmer expects to see it, allowing:

@pipeline()
def daily_hycom_download():
    """ Download, process, and transfrom HYCOM data for a date """

    date = input_date()
    hycom_ds_for_date(date)

Ideas of Implementation

It looks like @solid() picks up the docstring if the description is not specified on line 92 of _Solid.__call__()

solid_def = SolidDefinition(
name=self.name,
input_defs=resolved_input_defs,
output_defs=output_defs,
compute_fn=compute_fn,
config_schema=self.config_schema,
description=self.description or fn.__doc__,

@pipeline() should similarly be able to be tweaked in _Pipeline.__call__() to get a similar result.

pipeline_def = PipelineDefinition(
name=self.name,
dependencies=dependencies,
solid_defs=solid_defs,
mode_defs=self.mode_definitions,
preset_defs=self.preset_definitions,
description=self.description,

Changing description=self.description of fn.__doc__, should it.

Additional Info


Message from the maintainers:

Excited about this feature? Give it a 👍. We factor engagement into prioritization.

@sryza
Copy link
Contributor

@sryza sryza commented May 24, 2021

Hi @abkfenris - I agree that this would be helpful to have. It looks like you've looked at the code already - is this something you'd be interested in submitting a PR for?

@abkfenris
Copy link
Author

@abkfenris abkfenris commented May 24, 2021

I haven't gotten as far as looking what I need to do to build and test locally yet, just poking around the repo, though apparently not enough to find that existing issue 🤦 .

I might be able to take a swing at it in the next week or so.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment