end
def state_label
+ ec = exit_code
+ return "Failed" if (ec && ec != 0)
get_combined(:state)
end
+ def exit_code
+ get_combined(:exit_code)
+ end
+
def docker_image
get_combined(:container_image)
end
# returns a string representing state of the work unit
end
+ def exit_code
+ # returns the work unit's execution exit code
+ end
+
def state_bootstrap_class
# returns a class like "danger", "success", or "warning" that a view can use directly to make a display class
end
end
end
+ [
+ ['cr_for_failed', 'Failed', 33],
+ ['completed', 'Complete', 0],
+ ].each do |cr_fixture, state, exit_code|
+ test "Completed ContainerRequest state = #{state} with exit_code = #{exit_code}" do
+ use_token 'active'
+ obj = find_fixture(ContainerRequest, cr_fixture)
+ wu = obj.work_unit
+ assert_equal state, wu.state_label
+ assert_equal exit_code, wu.exit_code
+ end
+ end
+
[
[Job, 'running_job_with_components', 1, 1, nil],
[Job, 'queued', nil, nil, 1],
vcpus: 1
ram: 123
+cr_for_failed:
+ uuid: zzzzz-xvhdp-cr4failedcontnr
+ owner_uuid: zzzzz-tpzed-xurymjxw79nv3jz
+ name: cr for container exit code not 0
+ state: Committed
+ priority: 1
+ created_at: 2016-01-11 11:11:11.111111111 Z
+ updated_at: 2016-01-11 11:11:11.111111111 Z
+ modified_at: 2016-01-11 11:11:11.111111111 Z
+ modified_by_user_uuid: zzzzz-tpzed-xurymjxw79nv3jz
+ container_image: test
+ cwd: test
+ output_path: test
+ command: ["echo", "hello"]
+ container_uuid: zzzzz-dz642-failedcntnr
+ runtime_constraints:
+ vcpus: 1
+ ram: 123
+
uncommitted:
uuid: zzzzz-xvhdp-cr4uncommittedc
owner_uuid: zzzzz-tpzed-xurymjxw79nv3jz
uuid: zzzzz-dz642-compltcontainer
owner_uuid: zzzzz-tpzed-xurymjxw79nv3jz
state: Complete
+ exit_code: 0
priority: 1
created_at: 2016-01-11 11:11:11.111111111 Z
updated_at: 2016-01-11 11:11:11.111111111 Z
uuid: zzzzz-dz642-compltcontainr2
owner_uuid: zzzzz-tpzed-xurymjxw79nv3jz
state: Complete
+ exit_code: 0
priority: 1
created_at: 2016-01-11 11:11:11.111111111 Z
updated_at: 2016-01-11 11:11:11.111111111 Z
uuid: zzzzz-dz642-requestingcntnr
owner_uuid: zzzzz-tpzed-xurymjxw79nv3jz
state: Complete
+ exit_code: 0
priority: 1
created_at: 2016-01-11 11:11:11.111111111 Z
updated_at: 2016-01-11 11:11:11.111111111 Z
uuid: zzzzz-dz642-requestercntnr1
owner_uuid: zzzzz-tpzed-xurymjxw79nv3jz
state: Complete
+ exit_code: 0
priority: 1
created_at: 2016-01-11 11:11:11.111111111 Z
updated_at: 2016-01-11 11:11:11.111111111 Z
ram: 12000000000
vcpus: 4
auth_uuid: zzzzz-gj3su-077z32aux8dg2s1
+
+failed_container:
+ uuid: zzzzz-dz642-failedcntnr
+ owner_uuid: zzzzz-tpzed-xurymjxw79nv3jz
+ state: Complete
+ exit_code: 33
+ priority: 1
+ created_at: 2016-01-11 11:11:11.111111111 Z
+ updated_at: 2016-01-11 11:11:11.111111111 Z
+ container_image: test
+ cwd: test
+ output: test
+ output_path: test
+ command: ["echo", "hello"]
+ runtime_constraints:
+ ram: 12000000000
+ vcpus: 4