simplews 1.7.1 → 1.7.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (2) hide show
  1. data/lib/simplews/jobs.rb +12 -11
  2. metadata +2 -2
data/lib/simplews/jobs.rb CHANGED
@@ -4,6 +4,7 @@ require 'yaml'
4
4
  require 'singleton'
5
5
  require 'rand'
6
6
  require 'zlib'
7
+ require 'base64'
7
8
 
8
9
 
9
10
 
@@ -414,55 +415,55 @@ class SimpleWS::Jobs < SimpleWS
414
415
  }
415
416
 
416
417
 
417
- desc "Return the names of the jobs in the queue"
418
+ desc "Job management: Return the names of the jobs in the queue"
418
419
  param_desc :return => "Array of job names"
419
420
  serve :queue, [], :return => :array do
420
421
  Scheduler.queue.collect{|info| info[:name]}
421
422
  end
422
423
 
423
- desc "Check the status of a job"
424
+ desc "Job management: Check the status of a job"
424
425
  param_desc :job => "Job identifier", :return => "Status code. Special status codes are: 'queue', 'done', 'error', and 'aborted'"
425
426
  serve :status, ['job'], :job => :string, :return => :string do |job|
426
427
  Scheduler.job_info(job)[:status].to_s
427
428
  end
428
429
 
429
- desc "Return an array with the messages issued by the job"
430
+ desc "Job management: Return an array with the messages issued by the job"
430
431
  param_desc :job => "Job identifier", :return => "Array with message strings"
431
432
  serve :messages, ['job'], :job => :string, :return => :array do |job|
432
433
  Scheduler.job_info(job)[:messages]
433
434
  end
434
435
 
435
- desc "Return a YAML string containing arbitrary information set up by the job"
436
+ desc "Job management: Return a YAML string containing arbitrary information set up by the job"
436
437
  param_desc :job => "Job identifier", :return => "Hash with arbitrary values in YAML format"
437
438
  serve :info, ['job'], :job => :string, :return => :string do |job|
438
439
  Scheduler.job_info(job)[:info].to_yaml
439
440
  end
440
441
 
441
- desc "Abort the job"
442
+ desc "Job management: Abort the job"
442
443
  param_desc :job => "Job identifier"
443
444
  serve :abort, %w(job), :job => :string, :return => false do |job|
444
445
  Scheduler.abort(job)
445
446
  end
446
447
 
447
- desc "Check if the job is done. Could have finished successfully, with error, or have been aborted"
448
+ desc "Job management: Check if the job is done. Could have finished successfully, with error, or have been aborted"
448
449
  param_desc :job => "Job identifier", :return => "True if the job has status 'done', 'error' or 'aborted'"
449
450
  serve :done, %w(job), :job => :string, :return => :boolean do |job|
450
451
  [:done, :error, :aborted].include? Scheduler.job_info(job)[:status].to_sym
451
452
  end
452
453
 
453
- desc "Check if the job has finished with error. The last message is the error message"
454
+ desc "Job management: Check if the job has finished with error. The last message is the error message"
454
455
  param_desc :job => "Job identifier", :return => "True if the job has status 'error'"
455
456
  serve :error, %w(job), :job => :string, :return => :boolean do |job|
456
457
  Scheduler.job_info(job)[:status] == :error
457
458
  end
458
459
 
459
- desc "Check if the job has been aborted"
460
+ desc "Job management: Check if the job has been aborted"
460
461
  param_desc :job => "Job identifier", :return => "True if the job has status 'aborted'"
461
462
  serve :aborted, %w(job), :job => :string, :return => :boolean do |job|
462
463
  Scheduler.job_info(job)[:status] == :aborted
463
464
  end
464
465
 
465
- desc "Return an array with result identifiers to be used with the 'result' operation. The content of the results depends
466
+ desc "Job management: Return an array with result identifiers to be used with the 'result' operation. The content of the results depends
466
467
  on the task"
467
468
  param_desc :job => "Job identifier", :return => "Array of result identifiers"
468
469
  serve :results, %w(job), :return => :array do |job|
@@ -471,12 +472,12 @@ class SimpleWS::Jobs < SimpleWS
471
472
  results.collect{|p| p[0]}
472
473
  end
473
474
 
474
- desc "Return the content of the result specified by the result identifier. These identifiers are retrieve using the 'results' operation"
475
+ desc "Job management: Return the content of the result specified by the result identifier. These identifiers are retrieve using the 'results' operation"
475
476
  param_desc :result => "Result identifier", :return => "Content of the result file, in Base64 encoding for compatibility"
476
477
  serve :result, %w(result), :return => :binary do |result|
477
478
  path = @results[result]
478
479
  raise ResultNotFound unless File.exist? path
479
- File.open(path).read
480
+ Base64.encode64 File.open(path).read
480
481
  end
481
482
 
482
483
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: simplews
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.7.1
4
+ version: 1.7.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Miguel Vazquez
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2009-12-31 00:00:00 +01:00
12
+ date: 2010-01-01 00:00:00 +01:00
13
13
  default_executable: start_ws
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency