=begin Titan API The ultimate, language agnostic, container based job processing framework. OpenAPI spec version: 0.3.2 Generated by: https://github.com/swagger-api/swagger-codegen.git =end require "uri" module IronTitan class JobsApi attr_accessor :api_client def initialize(api_client = ApiClient.default) @api_client = api_client end # Get job list by group name. # This will list jobs for a particular group. # @param group_name Name of group for this set of jobs. # @param [Hash] opts the optional parameters # @option opts [DateTime] :created_after Will return jobs created after this time. In RFC3339 format. # @option opts [Integer] :n Number of jobs to return. # @return [JobsWrapper] def groups_group_name_jobs_get(group_name, opts = {}) data, status_code, headers = groups_group_name_jobs_get_with_http_info(group_name, opts) return data end # Get job list by group name. # This will list jobs for a particular group. # @param group_name Name of group for this set of jobs. # @param [Hash] opts the optional parameters # @option opts [DateTime] :created_after Will return jobs created after this time. In RFC3339 format. # @option opts [Integer] :n Number of jobs to return. # @return [Array<(JobsWrapper, Fixnum, Hash)>] JobsWrapper data, response status code and response headers def groups_group_name_jobs_get_with_http_info(group_name, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug "Calling API: JobsApi#groups_group_name_jobs_get ..." end # verify the required parameter 'group_name' is set fail "Missing the required parameter 'group_name' when calling groups_group_name_jobs_get" if group_name.nil? # resource path local_var_path = "/groups/{group_name}/jobs".sub('{format}','json').sub('{' + 'group_name' + '}', group_name.to_s) # query parameters query_params = {} query_params[:'created_after'] = opts[:'created_after'] if opts[:'created_after'] query_params[:'n'] = opts[:'n'] if opts[:'n'] # header parameters header_params = {} # HTTP header 'Accept' (if needed) _header_accept = ['application/json'] _header_accept_result = @api_client.select_header_accept(_header_accept) and header_params['Accept'] = _header_accept_result # HTTP header 'Content-Type' _header_content_type = ['application/json'] header_params['Content-Type'] = @api_client.select_header_content_type(_header_content_type) # form parameters form_params = {} # http body (model) post_body = nil auth_names = [] data, status_code, headers = @api_client.call_api(:GET, local_var_path, :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => 'JobsWrapper') if @api_client.config.debugging @api_client.config.logger.debug "API called: JobsApi#groups_group_name_jobs_get\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # Cancel a job. # Cancels a job in delayed, queued or running status. The worker may continue to run a running job. reason is set to `client_request`. # @param group_name Name of group for this set of jobs. # @param id Job id # @param [Hash] opts the optional parameters # @return [JobWrapper] def groups_group_name_jobs_id_cancel_post(group_name, id, opts = {}) data, status_code, headers = groups_group_name_jobs_id_cancel_post_with_http_info(group_name, id, opts) return data end # Cancel a job. # Cancels a job in delayed, queued or running status. The worker may continue to run a running job. reason is set to `client_request`. # @param group_name Name of group for this set of jobs. # @param id Job id # @param [Hash] opts the optional parameters # @return [Array<(JobWrapper, Fixnum, Hash)>] JobWrapper data, response status code and response headers def groups_group_name_jobs_id_cancel_post_with_http_info(group_name, id, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug "Calling API: JobsApi#groups_group_name_jobs_id_cancel_post ..." end # verify the required parameter 'group_name' is set fail "Missing the required parameter 'group_name' when calling groups_group_name_jobs_id_cancel_post" if group_name.nil? # verify the required parameter 'id' is set fail "Missing the required parameter 'id' when calling groups_group_name_jobs_id_cancel_post" if id.nil? # resource path local_var_path = "/groups/{group_name}/jobs/{id}/cancel".sub('{format}','json').sub('{' + 'group_name' + '}', group_name.to_s).sub('{' + 'id' + '}', id.to_s) # query parameters query_params = {} # header parameters header_params = {} # HTTP header 'Accept' (if needed) _header_accept = ['application/json'] _header_accept_result = @api_client.select_header_accept(_header_accept) and header_params['Accept'] = _header_accept_result # HTTP header 'Content-Type' _header_content_type = ['application/json'] header_params['Content-Type'] = @api_client.select_header_content_type(_header_content_type) # form parameters form_params = {} # http body (model) post_body = nil auth_names = [] data, status_code, headers = @api_client.call_api(:POST, local_var_path, :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => 'JobWrapper') if @api_client.config.debugging @api_client.config.logger.debug "API called: JobsApi#groups_group_name_jobs_id_cancel_post\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # Delete the job. # Delete only succeeds if job status is one of `succeeded\n| failed | cancelled`. Cancel a job if it is another state and needs to\nbe deleted. All information about the job, including the log, is\nirretrievably lost when this is invoked.\n # @param group_name Name of group for this set of jobs. # @param id Job id # @param [Hash] opts the optional parameters # @return [nil] def groups_group_name_jobs_id_delete(group_name, id, opts = {}) groups_group_name_jobs_id_delete_with_http_info(group_name, id, opts) return nil end # Delete the job. # Delete only succeeds if job status is one of `succeeded\n| failed | cancelled`. Cancel a job if it is another state and needs to\nbe deleted. All information about the job, including the log, is\nirretrievably lost when this is invoked.\n # @param group_name Name of group for this set of jobs. # @param id Job id # @param [Hash] opts the optional parameters # @return [Array<(nil, Fixnum, Hash)>] nil, response status code and response headers def groups_group_name_jobs_id_delete_with_http_info(group_name, id, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug "Calling API: JobsApi#groups_group_name_jobs_id_delete ..." end # verify the required parameter 'group_name' is set fail "Missing the required parameter 'group_name' when calling groups_group_name_jobs_id_delete" if group_name.nil? # verify the required parameter 'id' is set fail "Missing the required parameter 'id' when calling groups_group_name_jobs_id_delete" if id.nil? # resource path local_var_path = "/groups/{group_name}/jobs/{id}".sub('{format}','json').sub('{' + 'group_name' + '}', group_name.to_s).sub('{' + 'id' + '}', id.to_s) # query parameters query_params = {} # header parameters header_params = {} # HTTP header 'Accept' (if needed) _header_accept = ['application/json'] _header_accept_result = @api_client.select_header_accept(_header_accept) and header_params['Accept'] = _header_accept_result # HTTP header 'Content-Type' _header_content_type = ['application/json'] header_params['Content-Type'] = @api_client.select_header_content_type(_header_content_type) # form parameters form_params = {} # http body (model) post_body = nil auth_names = [] data, status_code, headers = @api_client.call_api(:DELETE, local_var_path, :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names) if @api_client.config.debugging @api_client.config.logger.debug "API called: JobsApi#groups_group_name_jobs_id_delete\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # Mark job as failed. # Job is marked as failed if it was in a valid state. Job's `completed_at` time is initialized. # @param group_name Name of group for this set of jobs. # @param id Job id # @param reason Reason for job failure. # @param [Hash] opts the optional parameters # @return [JobWrapper] def groups_group_name_jobs_id_error_post(group_name, id, reason, opts = {}) data, status_code, headers = groups_group_name_jobs_id_error_post_with_http_info(group_name, id, reason, opts) return data end # Mark job as failed. # Job is marked as failed if it was in a valid state. Job's `completed_at` time is initialized. # @param group_name Name of group for this set of jobs. # @param id Job id # @param reason Reason for job failure. # @param [Hash] opts the optional parameters # @return [Array<(JobWrapper, Fixnum, Hash)>] JobWrapper data, response status code and response headers def groups_group_name_jobs_id_error_post_with_http_info(group_name, id, reason, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug "Calling API: JobsApi#groups_group_name_jobs_id_error_post ..." end # verify the required parameter 'group_name' is set fail "Missing the required parameter 'group_name' when calling groups_group_name_jobs_id_error_post" if group_name.nil? # verify the required parameter 'id' is set fail "Missing the required parameter 'id' when calling groups_group_name_jobs_id_error_post" if id.nil? # verify the required parameter 'reason' is set fail "Missing the required parameter 'reason' when calling groups_group_name_jobs_id_error_post" if reason.nil? # resource path local_var_path = "/groups/{group_name}/jobs/{id}/error".sub('{format}','json').sub('{' + 'group_name' + '}', group_name.to_s).sub('{' + 'id' + '}', id.to_s) # query parameters query_params = {} # header parameters header_params = {} # HTTP header 'Accept' (if needed) _header_accept = ['application/json'] _header_accept_result = @api_client.select_header_accept(_header_accept) and header_params['Accept'] = _header_accept_result # HTTP header 'Content-Type' _header_content_type = ['application/json'] header_params['Content-Type'] = @api_client.select_header_content_type(_header_content_type) # form parameters form_params = {} form_params["reason"] = reason # http body (model) post_body = nil auth_names = [] data, status_code, headers = @api_client.call_api(:POST, local_var_path, :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => 'JobWrapper') if @api_client.config.debugging @api_client.config.logger.debug "API called: JobsApi#groups_group_name_jobs_id_error_post\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # Gets job by id # Gets a job by id. # @param group_name Name of group for this set of jobs. # @param id Job id # @param [Hash] opts the optional parameters # @return [JobWrapper] def groups_group_name_jobs_id_get(group_name, id, opts = {}) data, status_code, headers = groups_group_name_jobs_id_get_with_http_info(group_name, id, opts) return data end # Gets job by id # Gets a job by id. # @param group_name Name of group for this set of jobs. # @param id Job id # @param [Hash] opts the optional parameters # @return [Array<(JobWrapper, Fixnum, Hash)>] JobWrapper data, response status code and response headers def groups_group_name_jobs_id_get_with_http_info(group_name, id, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug "Calling API: JobsApi#groups_group_name_jobs_id_get ..." end # verify the required parameter 'group_name' is set fail "Missing the required parameter 'group_name' when calling groups_group_name_jobs_id_get" if group_name.nil? # verify the required parameter 'id' is set fail "Missing the required parameter 'id' when calling groups_group_name_jobs_id_get" if id.nil? # resource path local_var_path = "/groups/{group_name}/jobs/{id}".sub('{format}','json').sub('{' + 'group_name' + '}', group_name.to_s).sub('{' + 'id' + '}', id.to_s) # query parameters query_params = {} # header parameters header_params = {} # HTTP header 'Accept' (if needed) _header_accept = ['application/json'] _header_accept_result = @api_client.select_header_accept(_header_accept) and header_params['Accept'] = _header_accept_result # HTTP header 'Content-Type' _header_content_type = ['application/json'] header_params['Content-Type'] = @api_client.select_header_content_type(_header_content_type) # form parameters form_params = {} # http body (model) post_body = nil auth_names = [] data, status_code, headers = @api_client.call_api(:GET, local_var_path, :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => 'JobWrapper') if @api_client.config.debugging @api_client.config.logger.debug "API called: JobsApi#groups_group_name_jobs_id_get\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # Get the log of a completed job. # Retrieves the log from log storage. # @param group_name Name of group for this set of jobs. # @param id Job id # @param [Hash] opts the optional parameters # @return [String] def groups_group_name_jobs_id_log_get(group_name, id, opts = {}) data, status_code, headers = groups_group_name_jobs_id_log_get_with_http_info(group_name, id, opts) return data end # Get the log of a completed job. # Retrieves the log from log storage. # @param group_name Name of group for this set of jobs. # @param id Job id # @param [Hash] opts the optional parameters # @return [Array<(String, Fixnum, Hash)>] String data, response status code and response headers def groups_group_name_jobs_id_log_get_with_http_info(group_name, id, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug "Calling API: JobsApi#groups_group_name_jobs_id_log_get ..." end # verify the required parameter 'group_name' is set fail "Missing the required parameter 'group_name' when calling groups_group_name_jobs_id_log_get" if group_name.nil? # verify the required parameter 'id' is set fail "Missing the required parameter 'id' when calling groups_group_name_jobs_id_log_get" if id.nil? # resource path local_var_path = "/groups/{group_name}/jobs/{id}/log".sub('{format}','json').sub('{' + 'group_name' + '}', group_name.to_s).sub('{' + 'id' + '}', id.to_s) # query parameters query_params = {} # header parameters header_params = {} # HTTP header 'Accept' (if needed) _header_accept = ['text/plain'] _header_accept_result = @api_client.select_header_accept(_header_accept) and header_params['Accept'] = _header_accept_result # HTTP header 'Content-Type' _header_content_type = ['application/json'] header_params['Content-Type'] = @api_client.select_header_content_type(_header_content_type) # form parameters form_params = {} # http body (model) post_body = nil auth_names = [] data, status_code, headers = @api_client.call_api(:GET, local_var_path, :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => 'String') if @api_client.config.debugging @api_client.config.logger.debug "API called: JobsApi#groups_group_name_jobs_id_log_get\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # Send in a log for storage. # Logs are sent after a job completes since they may be very large and the runner can process the next job. # @param group_name Name of group for this set of jobs. # @param id Job id # @param log Output log for the job. Content-Type must be \"text/plain; charset=utf-8\". # @param [Hash] opts the optional parameters # @return [JobWrapper] def groups_group_name_jobs_id_log_post(group_name, id, log, opts = {}) data, status_code, headers = groups_group_name_jobs_id_log_post_with_http_info(group_name, id, log, opts) return data end # Send in a log for storage. # Logs are sent after a job completes since they may be very large and the runner can process the next job. # @param group_name Name of group for this set of jobs. # @param id Job id # @param log Output log for the job. Content-Type must be \"text/plain; charset=utf-8\". # @param [Hash] opts the optional parameters # @return [Array<(JobWrapper, Fixnum, Hash)>] JobWrapper data, response status code and response headers def groups_group_name_jobs_id_log_post_with_http_info(group_name, id, log, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug "Calling API: JobsApi#groups_group_name_jobs_id_log_post ..." end # verify the required parameter 'group_name' is set fail "Missing the required parameter 'group_name' when calling groups_group_name_jobs_id_log_post" if group_name.nil? # verify the required parameter 'id' is set fail "Missing the required parameter 'id' when calling groups_group_name_jobs_id_log_post" if id.nil? # verify the required parameter 'log' is set fail "Missing the required parameter 'log' when calling groups_group_name_jobs_id_log_post" if log.nil? # resource path local_var_path = "/groups/{group_name}/jobs/{id}/log".sub('{format}','json').sub('{' + 'group_name' + '}', group_name.to_s).sub('{' + 'id' + '}', id.to_s) # query parameters query_params = {} # header parameters header_params = {} # HTTP header 'Accept' (if needed) _header_accept = ['application/json'] _header_accept_result = @api_client.select_header_accept(_header_accept) and header_params['Accept'] = _header_accept_result # HTTP header 'Content-Type' _header_content_type = ['multipart/form-data'] header_params['Content-Type'] = @api_client.select_header_content_type(_header_content_type) # form parameters form_params = {} form_params["log"] = log # http body (model) post_body = nil auth_names = [] data, status_code, headers = @api_client.call_api(:POST, local_var_path, :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => 'JobWrapper') if @api_client.config.debugging @api_client.config.logger.debug "API called: JobsApi#groups_group_name_jobs_id_log_post\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # Update a job # Used to update status on job transitions. Eg: from 'running' to 'success'. # @param group_name Name of group for this set of jobs. # @param id Job id # @param body Job data to post # @param [Hash] opts the optional parameters # @return [JobWrapper] def groups_group_name_jobs_id_patch(group_name, id, body, opts = {}) data, status_code, headers = groups_group_name_jobs_id_patch_with_http_info(group_name, id, body, opts) return data end # Update a job # Used to update status on job transitions. Eg: from 'running' to 'success'. # @param group_name Name of group for this set of jobs. # @param id Job id # @param body Job data to post # @param [Hash] opts the optional parameters # @return [Array<(JobWrapper, Fixnum, Hash)>] JobWrapper data, response status code and response headers def groups_group_name_jobs_id_patch_with_http_info(group_name, id, body, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug "Calling API: JobsApi#groups_group_name_jobs_id_patch ..." end # verify the required parameter 'group_name' is set fail "Missing the required parameter 'group_name' when calling groups_group_name_jobs_id_patch" if group_name.nil? # verify the required parameter 'id' is set fail "Missing the required parameter 'id' when calling groups_group_name_jobs_id_patch" if id.nil? # verify the required parameter 'body' is set fail "Missing the required parameter 'body' when calling groups_group_name_jobs_id_patch" if body.nil? # resource path local_var_path = "/groups/{group_name}/jobs/{id}".sub('{format}','json').sub('{' + 'group_name' + '}', group_name.to_s).sub('{' + 'id' + '}', id.to_s) # query parameters query_params = {} # header parameters header_params = {} # HTTP header 'Accept' (if needed) _header_accept = ['application/json'] _header_accept_result = @api_client.select_header_accept(_header_accept) and header_params['Accept'] = _header_accept_result # HTTP header 'Content-Type' _header_content_type = ['application/json'] header_params['Content-Type'] = @api_client.select_header_content_type(_header_content_type) # form parameters form_params = {} # http body (model) post_body = @api_client.object_to_http_body(body) auth_names = [] data, status_code, headers = @api_client.call_api(:PATCH, local_var_path, :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => 'JobWrapper') if @api_client.config.debugging @api_client.config.logger.debug "API called: JobsApi#groups_group_name_jobs_id_patch\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # Retry a job. # \"The /retry endpoint can be used to force a retry of jobs\nwith status succeeded or cancelled. It can also be used to retry jobs\nthat in the failed state, but whose max_retries field is 0. The retried\njob will continue to have max_retries = 0.\"\n # @param group_name Name of group for this set of jobs. # @param id Job id # @param [Hash] opts the optional parameters # @return [JobWrapper] def groups_group_name_jobs_id_retry_post(group_name, id, opts = {}) data, status_code, headers = groups_group_name_jobs_id_retry_post_with_http_info(group_name, id, opts) return data end # Retry a job. # \"The /retry endpoint can be used to force a retry of jobs\nwith status succeeded or cancelled. It can also be used to retry jobs\nthat in the failed state, but whose max_retries field is 0. The retried\njob will continue to have max_retries = 0.\"\n # @param group_name Name of group for this set of jobs. # @param id Job id # @param [Hash] opts the optional parameters # @return [Array<(JobWrapper, Fixnum, Hash)>] JobWrapper data, response status code and response headers def groups_group_name_jobs_id_retry_post_with_http_info(group_name, id, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug "Calling API: JobsApi#groups_group_name_jobs_id_retry_post ..." end # verify the required parameter 'group_name' is set fail "Missing the required parameter 'group_name' when calling groups_group_name_jobs_id_retry_post" if group_name.nil? # verify the required parameter 'id' is set fail "Missing the required parameter 'id' when calling groups_group_name_jobs_id_retry_post" if id.nil? # resource path local_var_path = "/groups/{group_name}/jobs/{id}/retry".sub('{format}','json').sub('{' + 'group_name' + '}', group_name.to_s).sub('{' + 'id' + '}', id.to_s) # query parameters query_params = {} # header parameters header_params = {} # HTTP header 'Accept' (if needed) _header_accept = ['application/json'] _header_accept_result = @api_client.select_header_accept(_header_accept) and header_params['Accept'] = _header_accept_result # HTTP header 'Content-Type' _header_content_type = ['application/json'] header_params['Content-Type'] = @api_client.select_header_content_type(_header_content_type) # form parameters form_params = {} # http body (model) post_body = nil auth_names = [] data, status_code, headers = @api_client.call_api(:POST, local_var_path, :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => 'JobWrapper') if @api_client.config.debugging @api_client.config.logger.debug "API called: JobsApi#groups_group_name_jobs_id_retry_post\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # Mark job as succeeded. # Job status is changed to succeeded if it was in a valid state before. Job's `completed_at` time is initialized. # @param group_name Name of group for this set of jobs. # @param id Job id # @param [Hash] opts the optional parameters # @return [JobWrapper] def groups_group_name_jobs_id_success_post(group_name, id, opts = {}) data, status_code, headers = groups_group_name_jobs_id_success_post_with_http_info(group_name, id, opts) return data end # Mark job as succeeded. # Job status is changed to succeeded if it was in a valid state before. Job's `completed_at` time is initialized. # @param group_name Name of group for this set of jobs. # @param id Job id # @param [Hash] opts the optional parameters # @return [Array<(JobWrapper, Fixnum, Hash)>] JobWrapper data, response status code and response headers def groups_group_name_jobs_id_success_post_with_http_info(group_name, id, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug "Calling API: JobsApi#groups_group_name_jobs_id_success_post ..." end # verify the required parameter 'group_name' is set fail "Missing the required parameter 'group_name' when calling groups_group_name_jobs_id_success_post" if group_name.nil? # verify the required parameter 'id' is set fail "Missing the required parameter 'id' when calling groups_group_name_jobs_id_success_post" if id.nil? # resource path local_var_path = "/groups/{group_name}/jobs/{id}/success".sub('{format}','json').sub('{' + 'group_name' + '}', group_name.to_s).sub('{' + 'id' + '}', id.to_s) # query parameters query_params = {} # header parameters header_params = {} # HTTP header 'Accept' (if needed) _header_accept = ['application/json'] _header_accept_result = @api_client.select_header_accept(_header_accept) and header_params['Accept'] = _header_accept_result # HTTP header 'Content-Type' _header_content_type = ['application/json'] header_params['Content-Type'] = @api_client.select_header_content_type(_header_content_type) # form parameters form_params = {} # http body (model) post_body = nil auth_names = [] data, status_code, headers = @api_client.call_api(:POST, local_var_path, :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => 'JobWrapper') if @api_client.config.debugging @api_client.config.logger.debug "API called: JobsApi#groups_group_name_jobs_id_success_post\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # Extend job timeout. # Consumers can sometimes take a while to run the task after accepting it. An example is when the runner does not have the docker image locally, it can spend a significant time downloading the image.\nIf the timeout is small, the job may never get to run, or run but not be accepted by Titan. Consumers can touch the job before it times out. Titan will reset the timeout, giving the consumer another timeout seconds to run the job.\nTouch is only valid while the job is in a running state. If touch fails, the runner may stop running the job.\n # @param group_name Name of group for this set of jobs. # @param id Job id # @param [Hash] opts the optional parameters # @return [nil] def groups_group_name_jobs_id_touch_post(group_name, id, opts = {}) groups_group_name_jobs_id_touch_post_with_http_info(group_name, id, opts) return nil end # Extend job timeout. # Consumers can sometimes take a while to run the task after accepting it. An example is when the runner does not have the docker image locally, it can spend a significant time downloading the image.\nIf the timeout is small, the job may never get to run, or run but not be accepted by Titan. Consumers can touch the job before it times out. Titan will reset the timeout, giving the consumer another timeout seconds to run the job.\nTouch is only valid while the job is in a running state. If touch fails, the runner may stop running the job.\n # @param group_name Name of group for this set of jobs. # @param id Job id # @param [Hash] opts the optional parameters # @return [Array<(nil, Fixnum, Hash)>] nil, response status code and response headers def groups_group_name_jobs_id_touch_post_with_http_info(group_name, id, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug "Calling API: JobsApi#groups_group_name_jobs_id_touch_post ..." end # verify the required parameter 'group_name' is set fail "Missing the required parameter 'group_name' when calling groups_group_name_jobs_id_touch_post" if group_name.nil? # verify the required parameter 'id' is set fail "Missing the required parameter 'id' when calling groups_group_name_jobs_id_touch_post" if id.nil? # resource path local_var_path = "/groups/{group_name}/jobs/{id}/touch".sub('{format}','json').sub('{' + 'group_name' + '}', group_name.to_s).sub('{' + 'id' + '}', id.to_s) # query parameters query_params = {} # header parameters header_params = {} # HTTP header 'Accept' (if needed) _header_accept = ['application/json'] _header_accept_result = @api_client.select_header_accept(_header_accept) and header_params['Accept'] = _header_accept_result # HTTP header 'Content-Type' _header_content_type = ['application/json'] header_params['Content-Type'] = @api_client.select_header_content_type(_header_content_type) # form parameters form_params = {} # http body (model) post_body = nil auth_names = [] data, status_code, headers = @api_client.call_api(:POST, local_var_path, :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names) if @api_client.config.debugging @api_client.config.logger.debug "API called: JobsApi#groups_group_name_jobs_id_touch_post\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # Enqueue Job # Enqueues job(s). If any of the jobs is invalid, none of the jobs are enqueued.\n # @param group_name name of the group. # @param body Array of jobs to post. # @param [Hash] opts the optional parameters # @return [JobsWrapper] def groups_group_name_jobs_post(group_name, body, opts = {}) data, status_code, headers = groups_group_name_jobs_post_with_http_info(group_name, body, opts) return data end # Enqueue Job # Enqueues job(s). If any of the jobs is invalid, none of the jobs are enqueued.\n # @param group_name name of the group. # @param body Array of jobs to post. # @param [Hash] opts the optional parameters # @return [Array<(JobsWrapper, Fixnum, Hash)>] JobsWrapper data, response status code and response headers def groups_group_name_jobs_post_with_http_info(group_name, body, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug "Calling API: JobsApi#groups_group_name_jobs_post ..." end # verify the required parameter 'group_name' is set fail "Missing the required parameter 'group_name' when calling groups_group_name_jobs_post" if group_name.nil? # verify the required parameter 'body' is set fail "Missing the required parameter 'body' when calling groups_group_name_jobs_post" if body.nil? # resource path local_var_path = "/groups/{group_name}/jobs".sub('{format}','json').sub('{' + 'group_name' + '}', group_name.to_s) # query parameters query_params = {} # header parameters header_params = {} # HTTP header 'Accept' (if needed) _header_accept = ['application/json'] _header_accept_result = @api_client.select_header_accept(_header_accept) and header_params['Accept'] = _header_accept_result # HTTP header 'Content-Type' _header_content_type = ['application/json'] header_params['Content-Type'] = @api_client.select_header_content_type(_header_content_type) # form parameters form_params = {} # http body (model) post_body = @api_client.object_to_http_body(body) auth_names = [] data, status_code, headers = @api_client.call_api(:POST, local_var_path, :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => 'JobsWrapper') if @api_client.config.debugging @api_client.config.logger.debug "API called: JobsApi#groups_group_name_jobs_post\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # Get next job. # Gets the next job in the queue, ready for processing. Titan may return <=n jobs. Consumers should start processing jobs in order. Each returned job is set to `status` \"running\" and `started_at` is set to the current time. No other consumer can retrieve this job. # @param [Hash] opts the optional parameters # @option opts [Integer] :n Number of jobs to return. (default to 1) # @return [JobsWrapper] def jobs_get(opts = {}) data, status_code, headers = jobs_get_with_http_info(opts) return data end # Get next job. # Gets the next job in the queue, ready for processing. Titan may return <=n jobs. Consumers should start processing jobs in order. Each returned job is set to `status` \"running\" and `started_at` is set to the current time. No other consumer can retrieve this job. # @param [Hash] opts the optional parameters # @option opts [Integer] :n Number of jobs to return. # @return [Array<(JobsWrapper, Fixnum, Hash)>] JobsWrapper data, response status code and response headers def jobs_get_with_http_info(opts = {}) if @api_client.config.debugging @api_client.config.logger.debug "Calling API: JobsApi#jobs_get ..." end # resource path local_var_path = "/jobs".sub('{format}','json') # query parameters query_params = {} query_params[:'n'] = opts[:'n'] if opts[:'n'] # header parameters header_params = {} # HTTP header 'Accept' (if needed) _header_accept = ['application/json'] _header_accept_result = @api_client.select_header_accept(_header_accept) and header_params['Accept'] = _header_accept_result # HTTP header 'Content-Type' _header_content_type = ['application/json'] header_params['Content-Type'] = @api_client.select_header_content_type(_header_content_type) # form parameters form_params = {} # http body (model) post_body = nil auth_names = [] data, status_code, headers = @api_client.call_api(:GET, local_var_path, :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => 'JobsWrapper') if @api_client.config.debugging @api_client.config.logger.debug "API called: JobsApi#jobs_get\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end end end