Alice
01/20/2025, 2:10 AMflow.from_source(
source=github_repo,
entrypoint="script.py:flow"
).deploy(kwargs)
When I run on Linux this executes fine and deploys as expected. However when I try to run from a Windows machine I get
AttributeError: 'coroutine' object has no attribute 'deploy'
Does anybody know why this might be? I would like to set up workflows so that the dev team can deploy from their normal Windows machines without having to use a Linux subsystem if possible.Alice
01/21/2025, 11:39 PMMarvin
01/21/2025, 11:39 PMBianca Hoch
01/22/2025, 3:59 PMif __name__ == "__main__":
block, or something else?Bianca Hoch
01/22/2025, 3:59 PMAlice
01/27/2025, 11:13 PM# Imports etc
...
#### Main script ####
# Define entrypoints to deploy
entrypoints = {
'my_prefect_flow.py:flow': {
'cron': "*/30 * * * *"
},
'path/to/flow.py:media_feed' : {
'cron': "0 10 * * *"
},
'path/to/otherflow.py:main': {
# 'cron': "0 0 1 * *"
}
}
github_repo = GitRepository(
url="git@github.com:etc/etc",
)
# Run deployments
for e, dict_ in entrypoints.items():
sched = CronSchedule(
cron=dict_['cron'],
timezone="Australia/Sydney"
) if 'cron' in dict_.keys() else None
params = dict_['params'] if 'params' in dict_.keys() else None
# clean path for deployment name
deployment =e.split(".")[0].replace("_", "-").replace("/", "-")
print("Deployment name set:", deployment)
flow.from_source(
source=github_repo,
entrypoint=e
).deploy(
name=deployment,
work_pool_name="mainframe",
work_queue_name=repo_name,
schedules=[sched],
parameters=params,
tags=[work_pool, work_queue, hostname],
)
And I get the following error (only on Windows, not Linux)
AttributeError Traceback (most recent call last)
44 print("Deployment name set:", deployment)
46 flow.from_source(
47 source=github_repo,
48 entrypoint=e
---> 49 ).deploy(
50 name=deployment,
51 work_pool_name="mainframe",
52 work_queue_name=repo_name,
53 schedules=[sched],
54 parameters=params,
55 tags=[work_pool, work_queue, hostname],
56 )
AttributeError: 'coroutine' object has no attribute 'deploy'
Alice
01/27/2025, 11:32 PMflow.from_source(
source="git@github.com:renewmap/automation",
entrypoint='path/to/otherflow.py:main_flow'
).deploy(
name="otherflow-main_flow",
work_pool_name="mainframe",
work_queue_name="automation",
)
Still getting the same error
33 flow.from_source(
34 source="git@github.com:etc/etc",
35 entrypoint='path/to/otherflow.py:main_flow'
---> 36 ).deploy(
37 name="otherflow-main_flow",
38 work_pool_name="mainframe",
39 work_queue_name="automation",
40 )
AttributeError: 'coroutine' object has no attribute 'deploy'