Ben Fogelson
07/14/2020, 7:09 PMimport prefect as p
@p.task
def add_one(n):
    return n + 1
@p.task
def add_two(n):
    return n + 2
with p.Flow('f') as f:
    a = p.Parameter('a')
    b = add_one(a)
    b.slug = 'my_slug'
    c = add_two(a)
    c.slug = 'my_slug'
f.get_tasks(slug='my_slug') # returns both tasks
f.validate(). # passesJim Crist-Harif
07/14/2020, 7:15 PMJim Crist-Harif
07/14/2020, 7:16 PMJim Crist-Harif
07/14/2020, 7:17 PMimport prefect as p
@p.task
def add_one(n):
    return n + 1
@p.task
def add_two(n):
    return n + 2
with p.Flow('f') as f:
    a = p.Parameter('a')
    b = add_one(a, task_args={"slug": "my_slug"})
    c = add_two(a, task_args={"slug": "my_slug"})Jim Crist-Harif
07/14/2020, 7:34 PMslugslugBen Fogelson
07/14/2020, 7:36 PMitay livni
07/14/2020, 7:36 PMtargetsmerge_parametersI wouldn't expect users to really interact with `slug`s honestly - the main purpose of a slug is to have a stable ID that allows the Prefect API to determine which Python object is undergoing state updates. Slugs are not an inherent property of tasks, they're a property of tasks within flows, hence the move away from storing them on task objects directly.
Jeremiah
slugvalidate()validate()