https://prefect.io logo
Title
a

Austin Weisgrau

02/13/2023, 10:51 PM
Is there a way to check what the python API client expects for deployment name and flow name for deployments that have already been deployed to the cloud? I have found this behavior confusing. See examples in comment thread
1
First I fetch a list of deployments using the CLI.
$ prefect deployment ls

Deployments                              
┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓
┃ Name                         ┃ ID                                   ┃
┡━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┩
│ Hello World/hello world      │ f7fda63d-4994-4dad-b1e8-43ce39178e1b │
│ Hello World/helloworld       │ 83966cb9-814a-4164-8329-7bd42667d2ec │
│ Hello World/helloworld-local │ e6823648-faac-44ac-be75-24654a4f6683 │
└──────────────────────────────┴──────────────────────────────────────┘
Then I check if the python client can find the same deployments. If it can, the load() method will return True.
$ ipython

In [1]: from prefect.deployments import Deployment
In [2]: Deployment(name='Hello World', flow_name='helloworld').load()
Out[2]: False

In [3]: Deployment(name='helloworld', flow_name='helloworld').load()
Out[3]: False

In [4]: Deployment(name='helloworld', flow_name='Helloworld').load()
Out[4]: False

In [5]: Deployment(name='Hello World', flow_name='Helloworld').load()
Out[5]: False

In [9]: Deployment(name='hello world', flow_name='helloworld').load()
Out[9]: False

In [10]: Deployment(name='hello world', flow_name='Helloworld').load()
Out[10]: False

In [11]: Deployment(name='hello world', flow_name='Hello World').load()
Out[11]: True
Only the final example works to find one of the existing deployments, confusingly reversing the case of the deployment name and the flow name of the first row reported by the
prefect deployments ls
I haven't yet found a combo here that works to identify the second or third row
OK I figured this out too, it's just always reversed
$ prefect deployment ls

Deployments                              
┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓
┃ Name                         ┃ ID                                   ┃
┡━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┩
│ Hello World/hello world      │ f7fda63d-4994-4dad-b1e8-43ce39178e1b │
│ Hello World/helloworld       │ 83966cb9-814a-4164-8329-7bd42667d2ec │
│ Hello World/helloworld-local │ e6823648-faac-44ac-be75-24654a4f6683 │
└──────────────────────────────┴──────────────────────────────────────┘
In [11]: Deployment(name='hello world', flow_name='Hello World').load()
Out[11]: True

In [12]: Deployment(name='helloworld', flow_name='Hello World').load()
Out[12]: True

In [13]: Deployment(name='helloworld-local', flow_name='Hello World').load()
Out[13]: True