Container Request through API

Hello,

I have the following problem trying to create a container request through the API.
The use case is that I want to run a workflow (that I have already run the first time through arvados-cwl-runner). Upon reading the docs, I understand that I have to create a container request with its state being Commited.

Things like container_image and container_uuid I can find through the result page of the already run container. However, in the docs I also see that I have to set resources like cwd and output_path, which confuses me because I didn’t do so using the cli tool and I can’t find them anywhere (and thus set them randomly). When I use the following request, I get this error:

curl -k -X POST \
 -H "Authorization: OAuth2 $ARVADOS_API_TOKEN" \
 --data-urlencode container_request@/dev/stdin \
 https://$ARVADOS_API_HOST/arvados/v1/container_requests/ \
 <<EOF
{
  "container_uuid":"x3dm2-dz642-ywxuzrw93j62vg9",
  "container_image":"x3dm2-4zz18-59mq7hyzbu1rglu",
  "state":"commited",
  "cwd":"/",
  "output_path":"/output",
  "command":[
    "arvados-cwl-runner",
    "--local",
    "--api=containers",
    "--project-uuid=x3dm2-tpzed-amlr5fgf7gp7kgb",
    "--collection-cache-size=256",
    "/var/lib/cwl/workflow.json#main",
    "/var/lib/cwl/cwl.input.json"
  ]
}
EOF
{"errors":["State cannot change from  to uncommited (req-1k05gzz95byss1vt5b2i)","Container count cannot be modified in state 'uncommited' (0, 1) (req-1k05gzz95byss1vt5b2i)"],"error_token":"1594909570+49a14085"}%

Note that there is one extra space between from and to in the error message. I don’t know what more it expects! It’s supposedly a new container request, which happens to have the same uuid as an existing one and, as a result, it should run using the old container!

PS: Something happened and I created the same topic twice, sorry!

Hello George,

If what you’re trying to do is to re-run a previous container request, you can do that from the workbench.
If the objective is to do the same but programmatically, you can have a look at how workbench does it here:

https://dev.arvados.org/projects/arvados/repository/revisions/master/entry/apps/workbench/app/controllers/container_requests_controller.rb#L132

It seems that the issue is you’re trying to set the state to ‘commited’ (with 1 ‘t’) and it really needs to be ‘Uncommitted’, but maybe there’re some other issues. I think the workbench code is a good place to look.

Regards,
Lucas.

Thanks for the quick response.

I changed it to what you suggested and got this :
{"errors":["Container count cannot be modified in state 'Uncommitted' (0, 1) (req-61egc1imolp03ktzk2d8)"],"error_token":"1594913081+a5c687b6"}

Regards,
George

Have you tried without setting the container_uuid field on creation? The container’s uuid will be auto assigned to a previously run container or a newly created one. Also you may try to set the state to Committed at creation time or later to make the container request run (setting it to Uncommitted at first is what workbench does to allow the user to edit its inputs).
Also if your original container request has mounts, you may need to copy them too.

Regards,
Lucas.

Thanks, I will try that and get back to you.

Regards,
George

This indeed worked, thank you very much @ldipenti !

1 Like