Retrieve and Update an App
Once your app is created, we need to scale the worker up to 1. To do so, we will pass to the active_workers field the value '1' with a PUT request to:
PUT /app/<app-id>
where app-id
is the value returned from the previous tutorial.
Required Headers
x-api-key
: A valid API key that authenticates the user.x-team-id
: (Optional/Nullable) The ID of the team associated with the request.Content-Type
:application/json
- Bash
- Python
curl --location --request PUT 'https://api.rungen.ai/app/<APP-ID>' \
--header 'x-api-key: <YOUR-API-KEY>' \
--header 'Content-Type: application/json' \
--data '{
"configuration": {
"active_workers": 1
}
}'
import requests
import json
url = "https://api.rungen.ai/app/<APP-ID>"
payload = json.dumps({
"configuration": {
"active_workers": 1
}
})
headers = {
'x-api-key': '<YOUR-API-KEY>',
'Content-Type': 'application/json'
}
response = requests.request("PUT", url, headers=headers, data=payload)
print(response.text)
You should receive a response like this
{
"data": {
"configuration": {
"active_workers": 1,
"gpu_tier": "BASIC"
},
"created_at": "2024-12-15T13:42:54",
"created_by": "5a57d473-c8b9-4507-a325-a1b0b9fe2c5e",
"description": "This is my first app with Flux",
"id": "1836a0eb-d84b-4880-8d13-cfa4f3bdaeb5",
"name": "My first app",
"owner_team_id": "<YOUR-TEAM-ID>",
"owner_user_id": null,
"status": "INITIALIZING",
"updated_at": "2024-12-15T13:42:54",
"workflow": {
"model_url": "https://huggingface.co/black-forest-labs/FLUX.1-schnell",
"tools": {}
}
}
}
As you can see the status is in the INITIALIZING phase. Wait few minutes that the app becomes RUNNING; during this phase, the app will download the submitted model alongside all the tools (if any).
You can verify the status of the app by executing a get-app request to
GET /app/<app-id>
- Bash
- Python
curl --location 'https://api.rungen.ai/app/<APP-ID>' \
--header 'x-api-key: <YOUR-API-KEY>'
import requests
url = "https://api.rungen.ai/app/<APP-ID>"
payload = {}
headers = {
'x-api-key': '<YOUR-API-KEY>'
}
response = requests.request("GET", url, headers=headers, data=payload)
print(response.text)
You should get a response like this:
{
"data": {
"configuration": {
"active_workers": 1,
"gpu_tier": "STANDARD"
},
"created_at": "2024-11-17T14:22:06",
"created_by": "ee4988a7-48e2-44ae-81f5-178a44ebeb58",
"description": "This is my first app with Flux",
"id": "9fd3138f-4c5e-458d-acff-fdc7161b582c",
"jobs": {
"completed": 16,
"failed": 3,
"in_progress": 0,
"in_queue": 0,
"retried": 0
},
"name": "My first App",
"owner_team_id": null,
"owner_user_id": "ee4988a7-48e2-44ae-81f5-178a44ebeb58",
"status": "RUNNING",
"updated_at": "2024-12-15T13:29:04",
"workers": {
"idle": 0,
"initializing": 0,
"ready": 0,
"running": 0,
"throttled": 0,
"unhealthy": 0
},
"workflow": {
"model_url": "https://huggingface.co/black-forest-labs/FLUX.1-schnell",
"tools": {}
}
}
}
As you can see this endpoint gives you the following info:
- the status of the workers
- jobs statistics
- the configuration
- the status
In the previous response we can see that the app is RUNNING and ready to receive jobs.