Jeremy Phelps
06/16/2021, 10:27 AMKeyError: 'Task slug disable_sound_on_mixer_error_stores-1 not found in the current Flow; this is usually caused by changing the Flow without reregistering it with the Prefect API.'
The slug is a transformation of the name of a flow. Prefect replaced the hyphens with _
and added -1
to the end.
The error is happening when trying to run a different flow. Both flows are defined in the same Python source file.
Both flows were registered with the latest code, contrary to the suggestion in the error message.Zach Schumacher
06/16/2021, 1:47 PMJeremy Phelps
06/16/2021, 10:54 PM@task
def search_logs_for_mixer_error():
pass # Redacted
@task
def disable_sound_on_mixer_error_stores():
pass # Redacted
with OurFlow('search-logs-for-mixer-error',
Schedule(clocks=[CronClock('0 20 * * *')])) as flow_search_logs:
search = search_logs_for_mixer_error()
with OurFlow('disable-sound-on-mixer-error-stores',
Schedule(clocks=[CronClock('0 23 * * *')])) as flow:
disable = disable_sound_on_mixer_error_stores()
Jeremy Phelps
06/16/2021, 10:55 PM#!/usr/bin/env python
import sys
import os
if len(sys.argv) != 2:
print('Usage: %s <filename>' % sys.argv[0])
sys.exit(1)
MODULE_PATH = sys.argv[1]
MODULE_NAME = "flow_module"
import importlib
spec = importlib.util.spec_from_file_location(MODULE_NAME, MODULE_PATH)
module = importlib.util.module_from_spec(spec)
sys.modules[spec.name] = module
spec.loader.exec_module(module)
for flow in [ getattr(module, var) for var in dir(module) if var.startswith('flow') ]:
flow.register(project_name='our-project')
Jeremy Phelps
06/17/2021, 4:49 PMZach Schumacher
06/17/2021, 4:55 PMJeremy Phelps
06/17/2021, 4:56 PMJeremy Phelps
06/17/2021, 4:57 PMZach Schumacher
06/17/2021, 4:58 PMprefect backend cloud
prefect auth login --token $PREFECT_API_TOKEN
prefect register --project my-project -p /path/to/my/flows/
Jeremy Phelps
06/17/2021, 4:59 PMZach Schumacher
06/17/2021, 4:59 PMJeremy Phelps
06/17/2021, 4:59 PMZach Schumacher
06/17/2021, 5:00 PM--project TEXT The name of the Prefect project to register this flow in.
Required.
-p, --path TEXT A path to a file or a directory containing the flow(s) to
register. May be passed multiple times to specify
multiple paths.
-m, --module TEXT A python module name containing the flow(s) to register.
May be the full import path to a flow. May be passed
multiple times to specify multiple modules.
-j, --json TEXT A path or URL to a JSON file created by `prefect build`
containing the flow(s) to register. May be passed
multiple times to specify multiple paths. Note that this
path may be a remote url (e.g. <https://some>-
url/flows.json).
-n, --name TEXT The name of a flow to register from the specified
paths/modules. If provided, only flows with a matching
name will be registered. May be passed multiple times to
specify multiple flows. If not provided, all flows found
on all paths/modules will be registered.
-l, --label TEXT A label to add on all registered flow(s). May be passed
multiple times to specify multiple labels.
-f, --force Force flow registration, even if the flow's metadata is
unchanged.
--watch If set, the specified paths and modules will be monitored
and registration re-run upon changes.
-h, --help Show this message and exit.
Jeremy Phelps
06/17/2021, 5:00 PMprefect --version
.Zach Schumacher
06/17/2021, 5:01 PMpip show prefect
Zach Schumacher
06/17/2021, 5:06 PMprefect version
is the cli commandJeremy Phelps
06/17/2021, 5:07 PMJeremy Phelps
06/17/2021, 5:11 PMclick
does Prefect require? In the past I've found that it's very sensitive to the version of this library that gets installed.Jeremy Phelps
06/17/2021, 5:17 PMKevin Kho
Jeremy Phelps
06/21/2021, 5:31 PMenum34
library. A ton of my app's dependencies install enum34.Kevin Kho
Jeremy Phelps
06/21/2021, 5:33 PMJeremy Phelps
06/21/2021, 5:34 PMKevin Kho
Jeremy Phelps
06/21/2021, 5:35 PMpendulum.DateTime
after the upgrade.Kevin Kho
Zach Schumacher
06/21/2021, 5:44 PMKevin Kho
from prefect import Flow, task, Task
import prefect
@task
def abc_abc_abc_abc():
return 1
@task
def bcd_bcd_bcd_bcd():
return 1
with Flow("testing-abc-abc") as flow_abc:
abc_abc_abc_abc()
bcd_bcd_bcd_bcd()
with Flow("testing-bcd-bcd") as flow:
bcd_bcd_bcd_bcd()
Jeremy Phelps
06/21/2021, 7:08 PMenum34
from getting installed. That way I should be able to upgrade to Pendulum 2.0.0 without difficulty.