Module: Mutx::Tasks
- Defined in:
- lib/mutx/tasks/task.rb,
lib/mutx/tasks/tasks.rb,
lib/mutx/tasks/custom/param.rb,
lib/mutx/tasks/custom/params.rb
Defined Under Namespace
Modules: Custom
Classes: Task
Class Method Summary
collapse
Class Method Details
.delete!(task_id) ⇒ Object
51
52
53
54
55
56
57
58
59
60
61
|
# File 'lib/mutx/tasks/tasks.rb', line 51
def self.delete! task_id
if self.exist_task? task_id
Mutx::Database::MongoConnector.delete_task task_id
success = true
message = "Task deleted!"
else
success = false
message = "Could not find task with id '#{task_id}'"
end
{success:success, message:message}
end
|
.exist?(task_id) ⇒ Boolean
39
40
41
|
# File 'lib/mutx/tasks/tasks.rb', line 39
def self.exist? task_id
self.exist_task? task_id
end
|
.exist_task?(task_id) ⇒ Boolean
35
36
37
|
# File 'lib/mutx/tasks/tasks.rb', line 35
def self.exist_task? task_id
!Mutx::Database::MongoConnector.task_data_for(task_id).nil?
end
|
.is_there_running_executions_for?(task_name) ⇒ Boolean
43
44
45
|
# File 'lib/mutx/tasks/tasks.rb', line 43
def self.is_there_running_executions_for? task_name
self.number_of_running_executions_for_task(task_name)>0
end
|
.is_there_task_with?(name, type = nil) ⇒ Boolean
5
6
7
|
# File 'lib/mutx/tasks/tasks.rb', line 5
def self.is_there_task_with? name, type=nil
self.task_id_for name, type
end
|
.number_of_running_executions_for_task(task_name) ⇒ Object
47
48
49
|
# File 'lib/mutx/tasks/tasks.rb', line 47
def self.number_of_running_executions_for_task task_name
Mutx::Database::MongoConnector.running_for_task(task_name).size
end
|
.running_tasks ⇒ Array
Returns the ids for running tasks
27
28
29
|
# File 'lib/mutx/tasks/tasks.rb', line 27
def self.running_tasks
Mutx::Database::MongoConnector.running_tasks
end
|
.running_tests ⇒ Object
31
32
33
|
# File 'lib/mutx/tasks/tasks.rb', line 31
def self.running_tests
Mutx::Database::MongoConnector.running_tests
end
|
.task_id_for(task_name, type = nil) ⇒ Fixnum
Returns the id for given task name
20
21
22
23
|
# File 'lib/mutx/tasks/tasks.rb', line 20
def self.task_id_for(task_name, type=nil)
Mutx::Support::Log.debug "Tasks:Getting task id for #{task_name}" if Mutx::Support::Log
Mutx::Database::MongoConnector.task_id_for(task_name, type)
end
|
.tasks(type = nil) ⇒ Array
Returns a list of tasks id
12
13
14
15
|
# File 'lib/mutx/tasks/tasks.rb', line 12
def self.tasks type=nil
Mutx::Support::Log.debug "Tasks:Getting all tasks ids" if Mutx::Support::Log
Mutx::Database::MongoConnector.tasks(type)
end
|