Commit 330c3b77 authored by Alain Takoudjou's avatar Alain Takoudjou

Reconfigure condor worker

parent 402899ef
...@@ -74,7 +74,6 @@ class Recipe(GenericBaseRecipe): ...@@ -74,7 +74,6 @@ class Recipe(GenericBaseRecipe):
self.ipv6 = options['ip'].strip() self.ipv6 = options['ip'].strip()
self.condor_host = options['condor_host'].strip() self.condor_host = options['condor_host'].strip()
self.collector = options['collector_name'].strip() self.collector = options['collector_name'].strip()
self.centralhost = self.options['central-host'].strip()
def install(self): def install(self):
path_list = [] path_list = []
...@@ -91,10 +90,8 @@ class Recipe(GenericBaseRecipe): ...@@ -91,10 +90,8 @@ class Recipe(GenericBaseRecipe):
if self.options['machine-role'].strip() == "manager": if self.options['machine-role'].strip() == "manager":
self.role = "manager,submit" self.role = "manager,submit"
elif self.options['machine-role'].strip() == "worker": elif self.options['machine-role'].strip() == "worker":
if not self.centralhost:
raise Exception("ERROR: Cannot deploy condor worker without specify the central manager")
self.role = "execute" self.role = "execute"
install_args += ['--central-manager='+self.centralhost, install_args += ['--central-manager='+self.condor_host,
'--type='+self.role] '--type='+self.role]
configure = subprocess.Popen(install_args, env=self.environ, configure = subprocess.Popen(install_args, env=self.environ,
stdout=subprocess.PIPE) stdout=subprocess.PIPE)
...@@ -115,13 +112,15 @@ class Recipe(GenericBaseRecipe): ...@@ -115,13 +112,15 @@ class Recipe(GenericBaseRecipe):
self.substituteTemplate(self.getTemplateFilename('condor_config.generic'), self.substituteTemplate(self.getTemplateFilename('condor_config.generic'),
condor_configure)) condor_configure))
path_list.append(config) path_list.append(config)
#update condor_config.local
with open(config_local, 'a') as f:
f.write("\nSTART = TRUE")
#create condor binary launcher for slapos #create condor binary launcher for slapos
if not os.path.exists(self.wrapper_bin): if not os.path.exists(self.wrapper_bin):
os.makedirs(self.wrapper_bin, int('0744', 8)) os.makedirs(self.wrapper_bin, int('0744', 8))
if not os.path.exists(self.wrapper_sbin): if not os.path.exists(self.wrapper_sbin):
os.makedirs(self.wrapper_sbin, int('0744', 8)) os.makedirs(self.wrapper_sbin, int('0744', 8))
#self.path = wrapper_bin+":"+wrapper_sbin+":"+self.path
#generate script for each file in prefix/bin #generate script for each file in prefix/bin
for binary in os.listdir(self.prefix+'/bin'): for binary in os.listdir(self.prefix+'/bin'):
wrapper_location = os.path.join(self.wrapper_bin, binary) wrapper_location = os.path.join(self.wrapper_bin, binary)
...@@ -172,15 +171,11 @@ class Recipe(GenericBaseRecipe): ...@@ -172,15 +171,11 @@ class Recipe(GenericBaseRecipe):
#generate script for start condor #generate script for start condor
start_condor = os.path.join(self.wrapperdir, 'start_condor') start_condor = os.path.join(self.wrapperdir, 'start_condor')
#if self.role == "manager,submit":
# binary = os.path.join(self.wrapper_sbin, 'condor_master')
#elif self.role == "execute":
# binary = os.path.join(self.wrapper_bin, 'condor_run')
start_bin = os.path.join(self.wrapper_sbin, 'condor_master') start_bin = os.path.join(self.wrapper_sbin, 'condor_master')
condor_status = os.path.join(self.wrapper_bin, 'condor_status') condor_reconfig = os.path.join(self.wrapper_sbin, 'condor_reconfig')
wrapper = self.createPythonScript(start_condor, wrapper = self.createPythonScript(start_condor,
'%s.configure.condorStart' % __name__, '%s.configure.condorStart' % __name__,
dict(start_bin=start_bin, condor_status=condor_status) dict(start_bin=start_bin, condor_reconfig=condor_reconfig)
) )
path_list.append(wrapper) path_list.append(wrapper)
return path_list return path_list
...@@ -228,9 +223,9 @@ class AppSubmit(GenericBaseRecipe): ...@@ -228,9 +223,9 @@ class AppSubmit(GenericBaseRecipe):
if value and (value.startswith('http') or value.startswith('ftp')): if value and (value.startswith('http') or value.startswith('ftp')):
self.options['name_'+pos] = os.path.basename(urlparse.urlparse(value)[2]) self.options['name_'+pos] = os.path.basename(urlparse.urlparse(value)[2])
self.options['file_'+pos] = self.download(value) self.options['file_'+pos] = self.download(value)
os.chmod(self.options['file_'+pos], 0600)
else: else:
self.options['file_'+pos] = value self.options['file_'+pos] = value
os.chmod(self.options['file_'+pos], 0600)
executable = self.options['executable'] executable = self.options['executable']
if executable and (executable.startswith('http') or executable.startswith('ftp')): if executable and (executable.startswith('http') or executable.startswith('ftp')):
self.options['executable'] = self.download(executable, self.options['executable'] = self.download(executable,
...@@ -245,7 +240,7 @@ class AppSubmit(GenericBaseRecipe): ...@@ -245,7 +240,7 @@ class AppSubmit(GenericBaseRecipe):
path_list = [] path_list = []
#check if curent condor instance is an condor master #check if curent condor instance is an condor master
if self.options['machine-role'].strip() != "manager": if self.options['machine-role'].strip() != "manager":
print "ERROR: cannot submit a job to a worker condor instance" print "ERROR: cannot submit a job to Condor worker instance"
return [] return []
#Setup directory #Setup directory
jobdir = self.options['job-dir'].strip() jobdir = self.options['job-dir'].strip()
......
...@@ -48,8 +48,8 @@ def submitJob(args): ...@@ -48,8 +48,8 @@ def submitJob(args):
def condorStart(args): def condorStart(args):
"""Start Condor if deamons is currently stopped""" """Start Condor if deamons is currently stopped"""
result = os.system(args['condor_status']) result = os.system(args['condor_reconfig'])
if result != 0: if result != 0:
#process failled to restart that mean that condor deamons is not curently started #process failled to reconfig condor that mean that condor deamons is not curently started
os.system(args['start_bin']) os.system(args['start_bin'])
\ No newline at end of file
...@@ -223,7 +223,7 @@ ALLOW_READ = * ...@@ -223,7 +223,7 @@ ALLOW_READ = *
## but note that this will allow anyone to submit jobs or add ## but note that this will allow anyone to submit jobs or add
## machines to your pool and is a serious security risk. ## machines to your pool and is a serious security risk.
ALLOW_WRITE = $(FULL_HOSTNAME), $(IP_ADDRESS) ALLOW_WRITE = $(FULL_HOSTNAME), $(IP_ADDRESS), %(ipv6)s
#ALLOW_WRITE = *.your.domain, your-friend's-machine.other.domain #ALLOW_WRITE = *.your.domain, your-friend's-machine.other.domain
#DENY_WRITE = bad-machine.your.domain #DENY_WRITE = bad-machine.your.domain
......
...@@ -85,7 +85,6 @@ collector_name = SLAPOS-CONDOR-POOL ...@@ -85,7 +85,6 @@ collector_name = SLAPOS-CONDOR-POOL
role = manager role = manager
diskspace = 5 diskspace = 5
#submit application #submit application
central-manager =
app-name = condor_test app-name = condor_test
description-file = ${description-file:location}/${description-file:filename} description-file = ${description-file:location}/${description-file:filename}
executable = ${executable:location}/${executable:filename} executable = ${executable:location}/${executable:filename}
......
...@@ -30,7 +30,7 @@ md5sum = 9e9db6f4c5e38ce3fd45d43c2bf616a8 ...@@ -30,7 +30,7 @@ md5sum = 9e9db6f4c5e38ce3fd45d43c2bf616a8
recipe = slapos.recipe.template recipe = slapos.recipe.template
url = ${:_profile_base_location_}/instance-condor.cfg url = ${:_profile_base_location_}/instance-condor.cfg
output = ${buildout:directory}/template-condor.cfg output = ${buildout:directory}/template-condor.cfg
md5sum = 9df787cc62e2dc6741c2faf1b1e0f315 md5sum = 2a8a1eec88e960e5af3f121d019fc507
mode = 0644 mode = 0644
[description-file] [description-file]
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment