-
-
Save bitprophet/16a273d07772207e6f9d to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# | |
# Option 1: can be more compact but lots of sigils, different arg types, maybe confusing | |
# | |
@task(pre={ | |
'pretask1': None, # means no args | |
'pretask2': ['positional', 'args', 'in a list'], | |
'pretask3': {'keyword': 'args', 'in': 'a dict'}, | |
}) | |
def mytask(): | |
pass | |
# Could also still give a list of pre-tasks, with implied "no args" invocation, as we do now | |
@task(pre=['pretask1', 'pretask2']) | |
def mytask2(): | |
pass | |
# | |
# Option 2: use 1..N decorators so that it feels/looks more like a func call. | |
# but is now more verbose, and possible confusion re: @pre('task1', 'task2') not | |
# being a legal way to say 2 pre-tasks. Also possibly confusing if we continue to allow @task(pre=['task', 'names']) | |
# | |
@pre('pretask1') # No args | |
@pre('pretask2', 'positional', 'args') | |
@pre('pretask3', keyword='args') | |
@pre('pretask4', 'can now use', both='if desired') | |
@task | |
def mytask(): | |
pass |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment