// UpdateState makes an API call to change the state of a container.
func (dispatcher *Dispatcher) UpdateState(uuid string, newState arvados.ContainerState) error {
- if newState == Locked {
- return dispatcher.Lock(uuid)
- } else if newState == Queued {
- return dispatcher.Unlock(uuid)
- }
-
- // All other states
err := dispatcher.Arv.Update("containers", uuid,
arvadosclient.Dict{
"container": arvadosclient.Dict{"state": newState}},
assert_nil container.auth_uuid
end
- def create_new_container attrs={}
- attrs = {
- command: ['echo', 'foo'],
- container_image: 'img',
- output_path: '/tmp',
- priority: 1,
- runtime_constraints: {"vcpus" => 1, "ram" => 1},
- }
- c = Container.new attrs.merge(attrs)
- c.save!
- cr = ContainerRequest.new attrs.merge(attrs)
- cr.save!
- assert cr.update_attributes(container_uuid: c.uuid,
- state: ContainerRequest::Committed,
- ), show_errors(cr)
- return c
- end
-
[
[:queued, :lock, :success, 'Locked'],
[:queued, :unlock, 403, 'Queued'],