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

Add Artifact.{annotations,format,storage} setting context manager(s) #154

Open
JacobHayes opened this issue Jan 7, 2022 · 0 comments
Open
Labels
enhancement New feature or request good first issue Good for newcomers

Comments

@JacobHayes
Copy link
Member

JacobHayes commented Jan 7, 2022

This will allow us to more easily set fields for all Artifacts initiated within the block, including those generated by Producers. Ex:

with Graph(...) as g:
    with Artifact.defaults(annotations=[...], format=..., storage=...): # maybe better name than "default"
        g.artifacts.a = A(...)
        g.artifacts.b = compute(a=a)

We can likely use the arti.context to track stacks for each field (allowing nesting contexts). On Artifact initialization (or rather, in a pydantic @validator("...", always=True)s), we'll pull from the stack:

  • annotations should concatenate the arti.context annotation stack with those passed explicitly
  • format and storage should default to the last item in their respective arti.context stack, if not set explicitly

--

Something similar for Statistics and Thresholds would be interesting, but may be a bit trickier (eg: a Statistic may not work for all types, etc).

@JacobHayes JacobHayes changed the title Add Annotations setting context manager Add Artifact.{annotations,format,storage} setting context manager(s) Jan 7, 2022
@JacobHayes JacobHayes added enhancement New feature or request good first issue Good for newcomers labels Jan 7, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

1 participant