Multiple deployments at the same time
mulongfu opened this issue · 1 comments
Hi,
I'm new to Singularity
I write a simple script as below
#!/bin/bash
name=1
for i in {1..5};
do
sleep 0.8
jq -n '{ "deploy": { "requestId": "test", "id": "ts'$name'", "command": "cd /xxx/xxx/project; ./echo-1.sh", "resources": { "cpus": 0.1, "memoryMb": 0.1 },"user": "xxx"}}' > sin.json
curl -i -X POST -H "Content-Type: application/json" -d@sin.json dhttp://xxx:8081/singularity/api/deploys &
name=$(($name+1))
wait
done
When I execute this script, I get the following error:
{"code":409,"message":"Pending deploy already in progress for test - cancel it or wait for it to complete (SingularityPendingDeploy{deployMarker=SingularityDeployMarker{requestId='test', deployId='ts4', timestamp=1590059053555, user=Optional.empty, message=Optional.empty}, lastLoadBalancerUpdate=Optional.empty, currentDeployState=WAITING, deployProgress=Optional.empty, updatedRequest=Optional.empty})"}
It seems that I need to wait Singularity to finish the previous deploy, then I can deploy the next one
Mesos Version: 1.9.0
Singularity Version: 1.0.0
Here is the request-id: test's JSON:
{
"request": {
"id": "test",
"requestType": "RUN_ONCE",
"owners": [
"xxx"
],
"killOldNonLongRunningTasksAfterMillis": 20,
"taskExecutionTimeLimitMillis": 20
},
"state": "ACTIVE",
"requestDeployState": {
"requestId": "test",
"activeDeploy": {
"requestId": "test",
"deployId": "ts4",
"timestamp": 1590059053555
}
},
"activeDeploy": {
"requestId": "test",
"id": "ts4",
"command": "cd xxx/project; ./echo-1.sh",
"resources": {
"cpus": 0.1,
"memoryMb": 0.1,
"numPorts": 0,
"diskMb": 0
},
"user": "joechang",
"s3UploaderAdditionalFiles": []
},
"taskIds": {
"healthy": [],
"notYetHealthy": [],
"pending": [],
"cleaning": [],
"loadBalanced": [],
"killed": []
}
}
Does the Singularity have the ability to deploy the request at the time?
If so, how can I do that?
Thanks,
This is working as designed here. Singularity aims to have one 'version' of. ode running for a request at a given time, with overlap while a deploy is in progress. If you have multiple versions of code that need to run at a time, the general pattern for that in Singularity would be to use multiple requestIds instead of multiple deploys of the same request. There is a bit more on requests and deploys in our docs https://getsingularity.com/Docs/about/requests-and-deploys.html