Class: FlowConfig
- Inherits:
-
Object
- Object
- FlowConfig
- Defined in:
- lib/manband/flowconfig.rb
Overview
This class holds the base config
Constant Summary collapse
- @@workdir =
'/tmp'- @@s3host =
'localhost'- @@s3port =
'8773'- @@s3path =
'/services/Walrus'- @@uploaddir =
'/tmp/upload'- @@sudo =
Sudo commands
false
Class Method Summary collapse
- .config ⇒ Object
-
.getjobdir(workflowdir = nil) ⇒ Object
Returns a work directory for a job.
- .s3host ⇒ Object
- .s3path ⇒ Object
- .s3port ⇒ Object
-
.sets3(host, port = '8773', path = '/services/Walrus') ⇒ Object
Sets S3 storage parameters.
-
.setsudo(dosudo) ⇒ Object
Sets sudo mode If sudo is set, job commands are run with a sudo on user id.
-
.setuploaddir(directory) ⇒ Object
defines upload directory for webband It must be accessible by the handlers.
-
.setworkdir(directory) ⇒ Object
Defines the work directory.
- .sudo ⇒ Object
- .uploaddir ⇒ Object
- .workdir ⇒ Object
Class Method Details
.config ⇒ Object
116 117 118 119 120 121 122 123 124 125 126 127 128 129 |
# File 'lib/manband/flowconfig.rb', line 116 def self.config url ||= (ENV["AMQP_URL"] || "amqp://guest:guest@localhost/") uri = URI.parse(url) { :vhost => uri.path, :host => uri.host, :user => uri.user, :port => (uri.port || 5672), :pass => uri.password, :heartbeat => 0 } rescue Object => e raise("invalid AMQP_URL: #{uri.inspect} (#{e})") end |
.getjobdir(workflowdir = nil) ⇒ Object
Returns a work directory for a job. Directory is based on a unique identifier.
107 108 109 110 111 112 113 114 |
# File 'lib/manband/flowconfig.rb', line 107 def self.getjobdir(workflowdir = nil) uuid = UUID.new if workflowdir == nil return @@workdir+"/"+uuid.generate.to_s else return workflowdir+"/"+uuid.generate.to_s end end |
.s3host ⇒ Object
67 68 69 |
# File 'lib/manband/flowconfig.rb', line 67 def self.s3host return @@s3host end |
.s3path ⇒ Object
84 85 86 |
# File 'lib/manband/flowconfig.rb', line 84 def self.s3path return @@s3path end |
.s3port ⇒ Object
80 81 82 |
# File 'lib/manband/flowconfig.rb', line 80 def self.s3port return @@s3port end |
.sets3(host, port = '8773', path = '/services/Walrus') ⇒ Object
Sets S3 storage parameters
Parameters can be set in user config fiel under s3 parameter
74 75 76 77 78 |
# File 'lib/manband/flowconfig.rb', line 74 def self.sets3(host,port= '8773',path='/services/Walrus') @@s3host = host @@s3port = port @@s3path = path end |
.setsudo(dosudo) ⇒ Object
Sets sudo mode If sudo is set, job commands are run with a sudo on user id. User must exists on the system.
Can be set in user config file with sudo: true
59 60 61 |
# File 'lib/manband/flowconfig.rb', line 59 def self.setsudo(dosudo) @@sudo = dosudo end |
.setuploaddir(directory) ⇒ Object
defines upload directory for webband It must be accessible by the handlers
94 95 96 |
# File 'lib/manband/flowconfig.rb', line 94 def self.setuploaddir(directory) @@uploaddir = directory end |
.setworkdir(directory) ⇒ Object
Defines the work directory. It must be shared between job and workflow handlers.
100 101 102 |
# File 'lib/manband/flowconfig.rb', line 100 def self.setworkdir(directory) @@workdir=directory end |
.sudo ⇒ Object
50 51 52 |
# File 'lib/manband/flowconfig.rb', line 50 def self.sudo return @@sudo end |
.uploaddir ⇒ Object
63 64 65 |
# File 'lib/manband/flowconfig.rb', line 63 def self.uploaddir return @@uploaddir end |
.workdir ⇒ Object
88 89 90 |
# File 'lib/manband/flowconfig.rb', line 88 def self.workdir return @@workdir end |