Preload a Conda Environment for OML4Py
/py-scripts/v2/preload/conda
Request
There are no request parameters for this operation.
- application/json
object-
envName(required): string
Name of the conda environment to download.
-
overwrite: boolean
Whether to overwrite the downloaded conda environment.
-
timeout: integer
(int32)
Minimum Value:
600Maximum Value:43200Default Value:1800Timeout in seconds that controls the lifecycle of the preloaded environment.
Response
- application/json
200 Response
400 Response
500 Response
Examples
Example 1: Preload a Conda Environment
The following example posts a request to preload the Conda environment
seaborn_env. Because the operation runs asynchronously, the
service returns a job identifier that can be used to monitor progress and retrieve
the result.
curl -i -k -X POST \
--header "Authorization: Bearer ${token}" \
--header "Content-Type: application/json" \
--header "Accept: application/json" \
-d '{
"envName": "seaborn_env",
"timeout": 3600,
"overwrite": false
}' \
"<oml-cloud-service-location-url>/oml/api/py-scripts/v2/preload/conda"
Response Headers: Preload Job Created
The preload operation runs asynchronously. When the request is accepted, the service
returns HTTP 201 Created and includes the job location in the
Location header.
HTTP/2 201 Created
Server: nginx/1.14.1
Date: Mon, 06 Apr 2026 17:34:11 GMT
Content-Length: 0
Connection: keep-alive
Strict-Transport-Security: max-age=31536000;includeSubDomains
X-Content-Type-Options: nosniff
Set-Cookie: JSESSIONID=node01e1m2cjnr0f041fpqat4ictbm30.node0; Path=/oml; Secure; HttpOnly
Expires: Thu, 01 Jan 1970 00:00:00 GMT
Location: <oml-cloud-service-location-url>/oml/api/py-scripts/v2/jobs/<job_id>
Check Job Status
Use the job identifier returned in the Location header to check the
preload status.
curl -i -k -X GET \
--header "Authorization: Bearer ${token}" \
--header "Accept: application/json" \
"<oml-cloud-service-location-url>/oml/api/py-scripts/v2/jobs/<job_id>"
While the preload operation is running:
{
"createdDate": "2026-04-01 15:31:26 UTC",
"status": "job is still running",
"elapsedTime": "00:00:38"
}
When the preload operation completes:
HTTP/2 302 Found
Server: nginx/1.14.1
Date: Mon, 06 Apr 2026 17:38:53 GMT
Content-Length: 0
Connection: keep-alive
Strict-Transport-Security: max-age=31536000;includeSubDomains
X-Content-Type-Options: nosniff
Content-Location: <oml-cloud-service-location-url>/oml/api/py-scripts/v2/jobs/<job_id>
Retrieve Job Result
curl -i -k -X GET \
--header "Authorization: Bearer ${token}" \
--header "Accept: application/json" \
"<oml-cloud-service-location-url>/oml/api/py-scripts/v2/jobs/<job_id>/result"
The result endpoint returns one of the following responses:
- Environment Preloaded Successfully
- Environment Not Found
- Environment Already Preloaded
- Preload Request Already in Progress
- Preloaded Environment Limit Reached
Example Response
Environment Preloaded Successfully{
"result": "'seaborn_env' successfully preloaded"
}Environment
Not FoundThe following response is returned when the specified Conda environment does not exist in Object Storage.
{
"errorMessage": "{\"Unexpected Conda Execution Error\":\"environment 'seabor' not found\"}",
"errorCode": 1026,
"request_id": "OML-562ca10dc2c445979b20745d8a"
}Environment
Already PreloadedThe following response is returned when the specified Conda
environment is already preloaded and overwrite is set to
false.
{
"errorMessage": "Conda environment 'sbenv' is already preloaded, set 'overwrite' to true to overwrite",
"errorCode": 1026,
"request_id": "OML-7af63b32bf734595a6d5c941fe"
}Preload
Request Already in ProgressThe following response is returned when a preload request for the specified environment is already running.
{
"errorMessage": "Conda environment 'sbenv_py313' preload request is already in progress, please wait for completion before retrying",
"errorCode": 1026,
"request_id": "OML-bfd9a4de352341c3bf88475c99"
}Preloaded
Environment Limit ReachedThe following response is returned when the user has reached the maximum number of allowed preloaded Conda environments.
{
"errorMessage": "Preloaded Conda environments limit (3) reached",
"errorCode": 1026,
"request_id": "OML-17e3158808a04e62a580d42b39"
}Example 2: Run a Script Using a Preloaded Conda Environment
The following example uses the preloaded Conda environment
seaborn_env to execute the Python script
test_seaborn_noinp.
curl -i -X POST \
--header "Authorization: Bearer ${token}" \
--header "Content-Type: application/json" \
--header "Accept: application/json" \
-d '{"envName": "conda:seaborn_env", "graphicsFlag": true}' \
"<oml-cloud-service-location-url>/oml/api/py-scripts/v2/do-eval/test_seaborn_noinp"
The following response is returned:
{
"result": [
{
"IMAGE": "iVBORw0KGgoAAAANSUhEUgAAA……AABJRU5ErkJggg==",
"DATA": "\"hello world\"",
"TITLE": "Dist plot",
"ID": 1
}
]
}
The response contains the script output in the DATA field and the
generated plot image in the IMAGE field.