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

parameter-dependent operations example unclear #46

Open
atravitz opened this issue Oct 1, 2019 · 0 comments
Open

parameter-dependent operations example unclear #46

atravitz opened this issue Oct 1, 2019 · 0 comments

Comments

@atravitz
Copy link
Collaborator

atravitz commented Oct 1, 2019

I'm unable to reproduce the below example for parameter-dependent operations, and I think that adding less-arbitrary naming might help clarify where this is useful.

class Project(FlowProject):
     pass


 def add_foo_workflow(bar):

     job.doc.setdefault('foo', dict())

     def foo_ran(job):
         return bar in job.doc.foo

     # Make sure to make the operation-name a function of the parameter(s)!
     @Project.operation('foo-{})'.format(bar))
     @Project.post(foo_ran)
     def foo(job):
         job.doc.foo[bar] = 'hello world!'


for bar in (4, 8, 15, 16, 23, 42):
    add_foo_workflow(bar=bar)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant