class Conductor::Tasks

Public Class Methods

acknowledge_task(task_id, worker_id: nil) click to toggle source

POST /tasks/{taskId}/ack Ack Task is recieved

# File lib/nf-conductor/http/tasks.rb, line 51
def acknowledge_task(task_id, worker_id: nil)
  query_string = "/tasks/#{task_id}/ack?"
  query_string += "workerid=#{worker_id}" if worker_id

  response = Connection.new.post(query_string)
  Tasks.build(response)
end
add_task_log(task_id, task_log) click to toggle source

POST /tasks/{taskId}/log Log Task Execution Details

# File lib/nf-conductor/http/tasks.rb, line 68
def add_task_log(task_id, task_log)
  response = Connection.new.post(
    "/tasks/#{task_id}/log",
    { body: task_log.to_json }
  )
  Tasks.build(response)
end
batch_poll_for_tasks(task_type, worker_id: nil, domain: nil, count: nil, timeout: nil) click to toggle source

GET /tasks/poll/batch/{tasktype} batch Poll for a task of a certain type

# File lib/nf-conductor/http/tasks.rb, line 10
def batch_poll_for_tasks(task_type, worker_id: nil, domain: nil, count: nil, timeout: nil)
  query_string = "/tasks/poll/batch/#{task_type}?"
  query_string += "workerid=#{worker_id}" if worker_id
  query_string += "&domain=#{domain}" if domain
  query_string += "&count=#{count}" if count
  query_string += "&timeout=#{timeout}" if timeout

  response = Connection.new.get(query_string)
  Tasks.build(response)
end
get_all_poll_data() click to toggle source

GET /tasks/queue/polldata/all Get the last poll data for a given task type

# File lib/nf-conductor/http/tasks.rb, line 99
def get_all_poll_data
  response = Connection.new.get("/tasks/queue/polldata/all")
  Tasks.build(response)
end
get_all_tasks() click to toggle source

GET /tasks/queue/all Get the details about each queue

# File lib/nf-conductor/http/tasks.rb, line 154
def get_all_tasks
  response = Connection.new.get("/tasks/queue/all")
  Tasks.build(response)
end
get_all_tasks_verbose() click to toggle source

GET /tasks/queue/all/verbose Get the details about each queue

# File lib/nf-conductor/http/tasks.rb, line 85
def get_all_tasks_verbose
  response = Connection.new.get("/tasks/queue/all/verbose")
  Tasks.build(response)
end
get_in_progress_task_in_workflow(workflow_id, task_name) click to toggle source

GET /tasks/in_progress/{workflowId}/{taskRefName} Get in progress task for a given workflow id.

# File lib/nf-conductor/http/tasks.rb, line 34
def get_in_progress_task_in_workflow(workflow_id, task_name)
  response = Connection.new.get("/tasks/in_progress/#{workflow_id}/#{task_name}")
  Tasks.build(response)
end
get_in_progress_tasks(task_type, start_key: nil, count: nil) click to toggle source

GET /tasks/in_progress/{tasktype} Get in progress tasks. The results are paginated.

# File lib/nf-conductor/http/tasks.rb, line 23
def get_in_progress_tasks(task_type, start_key: nil, count: nil)
  query_string = "/tasks/in_progress/#{task_type}?"
  query_string += "startKey=#{start_key}" if start_key
  query_string += "&count=#{count}" if count

  response = Connection.new.get(query_string)
  Tasks.build(response)
end
get_poll_data(task_type) click to toggle source

GET /tasks/queue/polldata Get the last poll data for a given task type

# File lib/nf-conductor/http/tasks.rb, line 92
def get_poll_data(task_type)
  response = Connection.new.get("/tasks/queue/polldata?taskType=#{task_type}")
  Tasks.build(response)
end
get_queue_sizes(task_types) click to toggle source

GET /tasks/queue/sizes Get Task type queue sizes

# File lib/nf-conductor/http/tasks.rb, line 120
def get_queue_sizes(task_types)
  task_types_query = task_types.is_a?(Array) ? task_types.to_query('taskType') : "taskType=#{taskType}"

  response = Connection.new.get("/tasks/queue/sizes?#{task_types_query}")
  Tasks.build(response)
end
get_task(task_id) click to toggle source

GET /tasks/{taskId} Get task by Id

# File lib/nf-conductor/http/tasks.rb, line 161
def get_task(task_id)
  response = Connection.new.get("/tasks/#{task_id}")
  Tasks.build(response)
end
get_task_logs(task_id) click to toggle source

GET /tasks/{taskId}/log Get Task Execution Logs

# File lib/nf-conductor/http/tasks.rb, line 61
def get_task_logs(task_id)
  response = Connection.new.get("/tasks/#{task_id}/log")
  Tasks.build(response)
end
new(response) click to toggle source
Calls superclass method Conductor::Model::new
# File lib/nf-conductor/http/tasks.rb, line 3
def initialize(response)
  super(response)
end
poll_task(task_type, worker_id: nil, domain: nil) click to toggle source

GET /tasks/poll/{tasktype} Poll for a task of a certain type

# File lib/nf-conductor/http/tasks.rb, line 129
def poll_task(task_type, worker_id: nil, domain: nil)
  query_string = "/tasks/poll/#{task_type}?"
  query_string += "workerid=#{worker_id}" if worker_id
  query_string += "&domain=#{domain}" if domain

  response = Connection.new.get(query_string)
  Tasks.build(response)
end
remove_task(task_type, task_id) click to toggle source

DELETE /tasks/queue/{taskType}/{taskId} Remove Task from a Task type queue

# File lib/nf-conductor/http/tasks.rb, line 78
def remove_task(task_type, task_id)
  response = Connection.new.delete("/tasks/queue/#{task_type}/#{task_id}")
  Tasks.build(response)
end
requeue_all_tasks() click to toggle source

POST /tasks/queue/requeue Requeue pending tasks for all the running workflows

# File lib/nf-conductor/http/tasks.rb, line 113
def requeue_all_tasks
  response = Connection.new.post("/tasks/queue/requeue")
  Tasks.build(response)
end
requeue_tasks(task_type) click to toggle source

POST /tasks/queue/requeue/{taskType} Requeue pending tasks

# File lib/nf-conductor/http/tasks.rb, line 106
def requeue_tasks(task_type)
  response = Connection.new.post("/tasks/queue/requeue/#{task_type}")
  Tasks.build(response)
end
search_task(start: nil, size: nil, sort: nil, free_text: nil, query: nil) click to toggle source

GET /tasks/search Search for tasks based in payload and other parameters

# File lib/nf-conductor/http/tasks.rb, line 140
def search_task(start: nil, size: nil, sort: nil, free_text: nil, query: nil)
  query_string = "/tasks/search?"
  query_string += "start=#{start}" if start
  query_string += "&size=#{size}" if size
  query_string += "&sort=#{sort}" if sort
  query_string += "&freeText=#{free_text}" if free_text
  query_string += "&query=#{query}" if query

  response = Connection.new.get(query_string)
  Tasks.build(response)
end
update_task(task_body) click to toggle source

POST /tasks Update a task

# File lib/nf-conductor/http/tasks.rb, line 41
def update_task(task_body)
  response = Connection.new.post(
    "/tasks",
    { body: task_body.to_json }
  )
  Tasks.build(response)
end