Blina
12/05/2023, 4:08 PMMarvin
12/05/2023, 4:10 PMPREFECT_PROFILES_PATH
, which by default is stored in your PREFECT_HOME
directory.
You can create, inspect, rename, and delete profiles using the Prefect CLI. For example, to create a new profile with no settings, you would use the command prefect profile create test
. To inspect the settings of a profile, you would use prefect profile inspect test
.
You can also set values in the current profile or in another profile by using the prefect config set
command. For example, to set a value in the current profile, you would use prefect config set VAR=X
. To set a value in another profile, you would use prefect --profile "foo" config set VAR=Y
.
For more detailed information, you can refer to the Prefect documentation.Nate
12/05/2023, 4:13 PMPREFECT_API_URL='<https://api.prefect.cloud/api/accounts/xxx/workspaces/xxx>'
• one that points at the ephemeral API (open-source server)
» prefect profile use oss
⠋ Connecting...
Connected.
» prefect profile inspect oss
PREFECT_API_URL='<http://127.0.0.1:4200/api>'
Blina
12/05/2023, 4:17 PMNate
12/05/2023, 4:17 PMprefect profile use oss
>
> prefect profile use someotherprofile
Blina
12/05/2023, 5:29 PMNate
12/05/2023, 5:32 PMBlina
12/05/2023, 5:33 PMBlina
12/05/2023, 5:34 PMBlina
12/06/2023, 8:55 AMMarvin
12/06/2023, 8:56 AMPREFECT_API_URL
and PREFECT_API_KEY
programmatically in Prefect 2.x with Python, you can use environment variables. Here's an example of how you can do this:
python
import os
# Set the Prefect API URL
os.environ["PREFECT_API_URL"] = "<https://api.prefect.cloud/api/accounts/[ACCOUNT-ID]/workspaces/[WORKSPACE-ID]>"
# Set the Prefect API key
os.environ["PREFECT_API_KEY"] = "[API-KEY]"
Replace [ACCOUNT-ID]
, [WORKSPACE-ID]
, and [API-KEY]
with your actual Prefect account ID, workspace ID, and API key.
Please be aware that setting environment variables like this will only affect the current process and any subprocesses that it spawns. These variables will not be set globally on your system and will not persist after your Python script terminates. If you need a more persistent configuration, consider using prefect
CLI commands or setting these variables in your environment before running your script.
For more details, you can visit the Prefect documentation on connecting to Prefect Cloud: Prefect Cloud - Connecting to the API.Nate
12/06/2023, 3:20 PMBlina
12/14/2023, 9:59 AM