Class: Girdle::Job
Instance Attribute Summary collapse
-
#id ⇒ Object
readonly
Returns the value of attribute id.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
Class Method Summary collapse
- .batch(spec, options = {}) ⇒ Object
- .list(options = {}) ⇒ Object
- .run(cmd, options = {}) ⇒ Object
- .submit(cmd, options = {}) ⇒ Object
Instance Method Summary collapse
- #active_cpu_power ⇒ Object
- #attributes ⇒ Object
- #attributes! ⇒ Object
- #date_now ⇒ Object
- #date_started ⇒ Object
- #date_stopped ⇒ Object
- #date_submitted ⇒ Object
- #delete ⇒ Object
-
#initialize(id) ⇒ Job
constructor
A new instance of Job.
- #log ⇒ Object
- #percent_done ⇒ Object
- #restart ⇒ Object
- #results(options = {}) ⇒ Object
- #resume ⇒ Object
- #specification ⇒ Object
- #status ⇒ Object
- #stop ⇒ Object
- #suspend ⇒ Object
- #task_count ⇒ Object
- #undone_task_count ⇒ Object
- #wait ⇒ Object
Methods included from Helpers
Constructor Details
#initialize(id) ⇒ Job
Returns a new instance of Job.
8 9 10 |
# File 'lib/girdle/job.rb', line 8 def initialize(id) @id = id end |
Instance Attribute Details
#id ⇒ Object (readonly)
Returns the value of attribute id.
6 7 8 |
# File 'lib/girdle/job.rb', line 6 def id @id end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
6 7 8 |
# File 'lib/girdle/job.rb', line 6 def name @name end |
Class Method Details
.batch(spec, options = {}) ⇒ Object
62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 |
# File 'lib/girdle/job.rb', line 62 def self.batch(spec, = {}) [ :gid, # grid identifier ], .merge!(job: 'batch') if spec.respond_to?(:to_plist) plist = spec.to_plist else plist = spec end Girdle.run_batch(plist, )['jobIdentifier'] end |
.list(options = {}) ⇒ Object
12 13 14 15 16 17 18 19 20 |
# File 'lib/girdle/job.rb', line 12 def self.list( = {}) [ :gid, # grid identifier ], .merge!(job: 'list') Girdle.run()['jobList'] end |
.run(cmd, options = {}) ⇒ Object
41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 |
# File 'lib/girdle/job.rb', line 41 def self.run(cmd, = {}) [ :gid, # grid identifier :si, # standard in :in, # in directory :so, # standard out :se, # standard error :out, # out directory :email, # notification email :art, # art path :artid, # art identifier :artequal, # art value (equal) :artmin, # art value (min) :artmax # art value (max) ], .merge!(job: 'run', cmd: cmd) Girdle.run() end |
.submit(cmd, options = {}) ⇒ Object
22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 |
# File 'lib/girdle/job.rb', line 22 def self.submit(cmd, = {}) [ :gid, # grid identifier :si, # standard in :in, # in directory :dids, # job identifiers :email, # notification email :art, # art path :artid, # art identifier :artequal, # art value (equal) :artmin, # art value (min) :artmax # art value (max) ], .merge!(job: 'submit', cmd: cmd) Girdle.run()['jobIdentifier'] end |
Instance Method Details
#active_cpu_power ⇒ Object
87 88 89 |
# File 'lib/girdle/job.rb', line 87 def active_cpu_power attributes['activeCPUPower'].to_i end |
#attributes ⇒ Object
78 79 80 |
# File 'lib/girdle/job.rb', line 78 def attributes @attributes ||= Girdle.run(job: 'attributes', id: id)['jobAttributes'] end |
#attributes! ⇒ Object
82 83 84 85 |
# File 'lib/girdle/job.rb', line 82 def attributes! @attributes = nil attributes end |
#date_now ⇒ Object
91 92 93 |
# File 'lib/girdle/job.rb', line 91 def date_now attributes['dateNow'] end |
#date_started ⇒ Object
95 96 97 |
# File 'lib/girdle/job.rb', line 95 def date_started attributes['dateStarted'] end |
#date_stopped ⇒ Object
99 100 101 |
# File 'lib/girdle/job.rb', line 99 def date_stopped attributes['dateStopped'] end |
#date_submitted ⇒ Object
103 104 105 |
# File 'lib/girdle/job.rb', line 103 def date_submitted attributes['dateSubmitted'] end |
#delete ⇒ Object
165 166 167 |
# File 'lib/girdle/job.rb', line 165 def delete Girdle.run(job: 'delete', id: id) end |
#log ⇒ Object
144 145 146 147 |
# File 'lib/girdle/job.rb', line 144 def log Girdle.run(job: 'log', id: id)['jobLog']. map {|log| Girdle::LogEntry.new(log) } end |
#percent_done ⇒ Object
115 116 117 |
# File 'lib/girdle/job.rb', line 115 def percent_done attributes['percentDone'] end |
#restart ⇒ Object
169 170 171 |
# File 'lib/girdle/job.rb', line 169 def restart Girdle.run(job: 'restart', id: id) end |
#results(options = {}) ⇒ Object
127 128 129 130 131 132 133 134 135 136 137 138 |
# File 'lib/girdle/job.rb', line 127 def results( = {}) self.class. [ :tid, # task identifier :so, # standard out :se, # standard error :out # out directory ], .merge!(job: 'results', id: id) Girdle.run_redirect().gsub /^$\n/, '' end |
#resume ⇒ Object
161 162 163 |
# File 'lib/girdle/job.rb', line 161 def resume Girdle.run(job: 'resume', id: id) end |
#specification ⇒ Object
140 141 142 |
# File 'lib/girdle/job.rb', line 140 def specification Girdle.run(job: 'specification', id: id)['jobSpecification'] end |
#status ⇒ Object
107 108 109 |
# File 'lib/girdle/job.rb', line 107 def status attributes['jobStatus'].downcase.to_sym end |
#stop ⇒ Object
153 154 155 |
# File 'lib/girdle/job.rb', line 153 def stop Girdle.run(job: 'stop', id: id) end |
#suspend ⇒ Object
157 158 159 |
# File 'lib/girdle/job.rb', line 157 def suspend Girdle.run(job: 'suspend', id: id) end |
#task_count ⇒ Object
119 120 121 |
# File 'lib/girdle/job.rb', line 119 def task_count attributes['taskCount'].to_i end |
#undone_task_count ⇒ Object
123 124 125 |
# File 'lib/girdle/job.rb', line 123 def undone_task_count attributes['undoneTaskCount'].to_i end |