Creating a Python virtual environment resource
After you have created the requirements.txt
file,
you can create the Python virtual environment resource.
Before you begin
- Download and configure the CDE CLI.
- Create a
requirements.txt
file specifying the Python package and version dependencies required by your CDE job.
Steps
-
Run the
cde resource create
command as follows to create a Python virtual environment resource.cde resource create --name cde-python-env-resource --type python-env --python-version python3
- Upload the
requirements.txt
file to the resource.cde resource upload --name cde-python-env-resource --local-path ${HOME}/requirements.txt
Result
When you first create a Python virtual environment resource, CDE
builds the environment according to the
requirements.txt
file. During this build time, you
cannot run a job associated with the virtual environment. You can
check the status of the environment by running cde resource
list-events --name <resource_name>
.
For example:
cde resource list-events --name cde-python-env-resource
The environment is ready when you see a message similar to the following:
{ "id": 4, "message": "Job pp-84kgdgf6-resource-builder-cde-python-env-resource-1634911572 succeeded, marking resource with ready status", "created": "2021-10-22T14:09:13Z" }