Class: FlowConfig

Inherits:
Object
  • Object
show all
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

Class Method Details

.configObject



126
127
128
129
130
131
132
133
134
135
136
137
138
139
# File 'lib/manband/flowconfig.rb', line 126

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.



117
118
119
120
121
122
123
124
# File 'lib/manband/flowconfig.rb', line 117

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

.s3hostObject



77
78
79
# File 'lib/manband/flowconfig.rb', line 77

def self.s3host
  return @@s3host
end

.s3pathObject



94
95
96
# File 'lib/manband/flowconfig.rb', line 94

def self.s3path
  return @@s3path
end

.s3portObject



90
91
92
# File 'lib/manband/flowconfig.rb', line 90

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



84
85
86
87
88
# File 'lib/manband/flowconfig.rb', line 84

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



69
70
71
# File 'lib/manband/flowconfig.rb', line 69

def self.setsudo(dosudo)
  @@sudo = dosudo
end

.setuploaddir(directory) ⇒ Object

defines upload directory for webband It must be accessible by the handlers



104
105
106
# File 'lib/manband/flowconfig.rb', line 104

def self.setuploaddir(directory)
  @@uploaddir = directory
end

.setworkdir(directory) ⇒ Object

Defines the work directory. It must be shared between job and workflow handlers.



110
111
112
# File 'lib/manband/flowconfig.rb', line 110

def self.setworkdir(directory)
  @@workdir=directory
end

.sudoObject



60
61
62
# File 'lib/manband/flowconfig.rb', line 60

def self.sudo
  return @@sudo
end

.uploaddirObject



73
74
75
# File 'lib/manband/flowconfig.rb', line 73

def self.uploaddir
  return @@uploaddir
end

.workdirObject



98
99
100
# File 'lib/manband/flowconfig.rb', line 98

def self.workdir
  return @@workdir
end