Commit c8fdc1b3 authored by Alain Takoudjou's avatar Alain Takoudjou

Add Stork Component and Recipe (with Walid SaaD)

parent 5dd29b62
[buildout]
parts =
globus
extends =
../openssl/buildout.cfg
../pkgconfig/buildout.cfg
../perl/buildout.cfg
../libaio/buildout.cfg
../libtool/buildout.cfg
../zlib/buildout.cfg
[globus]
recipe = slapos.recipe.cmmi
url = http://toolkit.globus.org/ftppub/gt5/5.2/5.2.5/installers/src/gt5.2.5-all-source-installer.tar.gz
md5sum = 10ecf1cdb3c4381cb4c1534f393d263f
environment =
PATH=${pkgconfig:location}/bin:${perl:location}/bin/:%(PATH)s
PKG_CONFIG_PATH=${openssl:location}/lib/pkgconfig
CPPFLAGS=-I${libtool:location}/include -I${zlib:location}/include -I${openssl:location}/include
LDFLAGS=-L${libtool:location}/lib -Wl,-rpath -Wl,${libtool:location}/lib -L${zlib:location}/lib -Wl,-rpath=${zlib:location}/lib -L${openssl:location}/lib -Wl,-rpath=${openssl:location}/lib -L${libaio:location}/lib -Wl,-rpath=${libaio:location}/lib
\ No newline at end of file
[buildout]
parts =
stork
extends =
../dash/buildout.cfg
../libexpat/buildout.cfg
../perl/buildout.cfg
../java/buildout.cfg
../openssl/buildout.cfg
../globus/buildout.cfg
../../stack/slapos.cfg
[download-stork]
recipe = hexagonit.recipe.download
url = http://sourceforge.net/projects/bonjour-grid/files/stork-package.tar.gz
strip-top-level-dir = true
md5sum = e228a7e0176c3af5167b83273b39f60a
[download-ksh]
recipe = hexagonit.recipe.download
download-only = true
url= http://garr.dl.sourceforge.net/project/bonjour-grid/ksh.2012-08-06.linux.i386-64
filename = ksh.2012-08-06.linux.i386-64
md5sum = 6b3824d6aacac7cfe7067bc8efb7e3dc
# Compile now stork
[stork]
recipe = plone.recipe.command
on_install = true
on_update = true
location = ${buildout:parts-directory}/${:_buildout_section_name_}
ksh = ${download-ksh:location}/${download-ksh:filename}
stop-on-error = true
command = cd ${download-stork:location} && \
chmod 744 ${:ksh} && ${:ksh} stork-install.ksh ${:location} && \
echo "Finished."
environment =
LD_LIBRARY_PATH=${libexpat:location}/lib:${openssl:location}/lib:${zlib:location}/lib:${globus:location}/lib
PATH=${perl:location}/bin:${java:location}/bin:${openssl:location}/bin:%(PATH)s
...@@ -194,6 +194,8 @@ setup(name=name, ...@@ -194,6 +194,8 @@ setup(name=name,
'sshkeys_authority = slapos.recipe.sshkeys_authority:Recipe', 'sshkeys_authority = slapos.recipe.sshkeys_authority:Recipe',
'sshkeys_authority.request = slapos.recipe.sshkeys_authority:Request', 'sshkeys_authority.request = slapos.recipe.sshkeys_authority:Request',
'stunnel = slapos.recipe.stunnel:Recipe', 'stunnel = slapos.recipe.stunnel:Recipe',
'stork = slapos.recipe.stork:Recipe',
'stork.submit = slapos.recipe.stork:AppSubmit',
'symbolic.link = slapos.recipe.symbolic_link:Recipe', 'symbolic.link = slapos.recipe.symbolic_link:Recipe',
'tidstorage = slapos.recipe.tidstorage:Recipe', 'tidstorage = slapos.recipe.tidstorage:Recipe',
'trac = slapos.recipe.trac:Recipe', 'trac = slapos.recipe.trac:Recipe',
......
##############################################################################
#
# Copyright (c) 2010 Vifib SARL and Contributors. All Rights Reserved.
#
# WARNING: This program as such is intended to be used by professional
# programmers who take the whole responsibility of assessing all potential
# consequences resulting from its eventual inadequacies and bugs
# End users who are looking for a ready-to-use solution with commercial
# guarantees and support are strongly adviced to contract a Free Software
# Service Company
#
# This program is Free Software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 3
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#
##############################################################################
from slapos.recipe.librecipe import GenericBaseRecipe
import os
import json
class Recipe(GenericBaseRecipe):
"""Deploy a fully operational condor architecture."""
def __init__(self, buildout, name, options):
self.environ = {}
self.role = ''
environment_section = options.get('environment-section', '').strip()
if environment_section and environment_section in buildout:
# Use environment variables from the designated config section.
self.environ.update(buildout[environment_section])
for variable in options.get('environment', '').splitlines():
if variable.strip():
try:
key, value = variable.split('=', 1)
self.environ[key.strip()] = value
except ValueError:
raise zc.buildout.UserError('Invalid environment variable definition: %s', variable)
# Extrapolate the environment variables using values from the current
# environment.
for key in self.environ:
self.environ[key] = self.environ[key] % os.environ
return GenericBaseRecipe.__init__(self, buildout, name, options)
def _options(self, options):
#Path of stork compiled package
self.package = options['package'].strip()
self.rootdir = options['rootdirectory'].strip()
#Other stork dependances
self.javabin = options['java-bin'].strip()
self.dash = options['dash'].strip()
#Directory to deploy stork
self.prefix = options['rootdirectory'].strip()
self.wrapper_bin = options['bin'].strip()
self.wrapper_sbin = options['sbin'].strip()
self.wrapper_log= options['log'].strip()
self.wrapper_tmp= options['tmp'].strip()
self.ipv4 = options['ipv4'].strip()
self.stork_host = options['stork_host'].strip()
self.stork_port = options['stork_port'].strip()
def install(self):
path_list = []
#get UID and GID for current slapuser
stat_info = os.stat(self.rootdir)
slapuser = str(stat_info.st_uid)+"."+str(stat_info.st_gid)
domain_name = 'slapos%s.com' % stat_info.st_uid
#Generate stork_mabroukconfig file
stork_config = os.path.join(self.rootdir, 'etc/stork_config')
stork_configure = dict(stork_host=self.stork_host, releasedir=self.prefix,
storkpackage=self.package,
slapuser=slapuser, ipv4=self.ipv4,
port=self.stork_port)
destination = os.path.join(stork_config)
# case 1: client and server in the same instance
if (self.options['machine-role'] == "client") and (self.options['stork_server']=='local'):
config = self.createFile(destination,
self.substituteTemplate(self.getTemplateFilename('stork_config.generic'),
stork_configure))
path_list.append(config)
#case 2: client and server in different instances (the server may b a remote host)
else:
config = self.createFile(destination,
self.substituteTemplate(self.getTemplateFilename('remote_stork_config.generic'),
stork_configure))
path_list.append(config)
#create stork binary launcher for slapos
if not os.path.exists(self.wrapper_bin):
os.makedirs(self.wrapper_bin, int('0700', 8))
if not os.path.exists(self.wrapper_sbin):
os.makedirs(self.wrapper_sbin, int('0700', 8))
if not os.path.exists(self.wrapper_log):
os.makedirs(self.wrapper_log, int('0700', 8))
if not os.path.exists(self.wrapper_tmp):
os.makedirs(self.wrapper_tmp, int('0700', 8))
#generate script for each file in prefix/bin
for binary in os.listdir(self.package+'/bin'):
wrapper_location = os.path.join(self.wrapper_bin, binary)
current_exe = os.path.join(self.package, 'bin', binary)
wrapper = open(wrapper_location, 'w')
content = """#!%s
export LD_LIBRARY_PATH=%s
export PATH=%s
export STORK_CONFIG=%s
export STORK_HOME=%s
export STORK_IDS=%s
export HOSTNAME=%s
exec %s $*""" % (self.dash,
self.environ['LD_LIBRARY_PATH'], self.environ['PATH'],
stork_config, self.prefix, slapuser,
self.environ['HOSTNAME'], current_exe)
wrapper.write(content)
wrapper.close()
path_list.append(wrapper_location)
os.chmod(wrapper_location, 0700)
#generate script for each file in prefix/sbin
for binary in os.listdir(self.package+'/sbin'):
wrapper_location = os.path.join(self.wrapper_sbin, binary)
current_exe = os.path.join(self.package, 'sbin', binary)
wrapper = open(wrapper_location, 'w')
content = """#!%s
export LD_LIBRARY_PATH=%s
export PATH=%s
export STORK_CONFIG=%s
export STORK_HOME=%s
export STORK_IDS=%s
export HOSTNAME=%s
exec %s $*""" % (self.dash,
self.environ['LD_LIBRARY_PATH'], self.environ['PATH'],
stork_config, self.prefix, slapuser,
self.environ['HOSTNAME'], current_exe)
wrapper.write(content)
wrapper.close()
path_list.append(wrapper_location)
os.chmod(wrapper_location, 0700)
#generate script for start stork
if self.options['stork_server']=='local':
start_bin = os.path.join(self.wrapper_sbin, 'stork_server')
wrapper = self.createPythonScript(self.options['wrapper-path'].strip(),
'%s.configure.storkStart' % __name__,
dict(start_bin=start_bin,
port=self.stork_port,
configfile=self.rootdir+'/etc/stork_config',
pid=self.options['pid']))
path_list.append(wrapper)
return path_list
class AppSubmit(GenericBaseRecipe):
"""Submit a stork job into an existing Stork server instance"""
def install(self):
path_list = []
download_dest_list = dict()
#check if curent stork instance is an stork server
if self.options['machine-role'].strip() == "server":
#raise Exception("Cannot submit a job to stork client instance")
print 'Cannot submit a job to stork client instance'
return path_list
#Setup directory
datadir = self.options['data-dir'].strip()
dest_url = self.options['dest_url'].strip()
source_url_list = self.options['json_src_url'].strip()
submitfile = os.path.join(datadir, 'submit-dap')
if self.options['dest_url']=='local':
dest_url = 'file:'+datadir
stork_submit = os.path.join(self.options['bin'].strip(), 'stork_submit')
file_list = '{}'
if str(self.options.get('src_from_file')).lower() in ['y', 'yes', '1', 'true'] \
and os.path.exists(source_url_list):
with open(source_url_list, 'r') as file_source:
file_list = json.loads(file_source.read())
else:
file_list = json.loads(source_url_list)
with open(submitfile, 'w') as stork_file:
# XXX - Simply, we don't want to download file twice with stork,
# skip file if it already exists at dest_url (only for file:path)
for filename in file_list:
if dest_url.startswith('file:'):
destination = os.path.join(dest_url.replace('file:', ''), filename)
if os.path.exists(destination+'_part') or os.path.exists(destination):
continue
download_dest_list[filename] = destination
stork_file.write("""[
src_url="%s";
dest_url="%s/%s_part";
err = "%s.err";
output = "%s.out";
dap_type = "transfer";
set_permission = "600" ;
]
""" % (file_list[filename], dest_url, filename, filename, filename)
)
parameter = dict(submit=stork_submit,
submit_file=submitfile,
stork_server=self.options['ipv4'].strip(),
server_port=self.options['stork_port'].strip(),
datadir=datadir)
submit_job = self.createPythonScript(
self.options['wrapper-path'].strip(),
'%s.configure.submitJob' % __name__, parameter
)
path_list.append(submit_job)
check_job = self.createPythonScript(
self.options['wrapper-check'].strip(),
'%s.configure.checkDownloadStatus' % __name__,
dict(dest_list=download_dest_list, cwd=self.options['log'])
)
path_list.append(check_job)
return path_list
\ No newline at end of file
##############################################################################
#
# Copyright (c) 2010 Vifib SARL and Contributors. All Rights Reserved.
#
# WARNING: This program as such is intended to be used by professional
# programmers who take the whole responsibility of assessing all potential
# consequences resulting from its eventual inadequacies and bugs
# End users who are looking for a ready-to-use solution with commercial
# guarantees and support are strongly adviced to contract a Free Software
# Service Company
#
# This program is Free Software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 3
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#
##############################################################################
import os
import subprocess
import time
def submitJob(args):
"""Run stork_submit (if needed) for job deployment"""
time.sleep(10)
# '-a', "log = out.log", '-a', "error = error.log",
server_info=args['stork_server']+':'+args['server_port']
launch_args = [args['submit'],server_info, args['submit_file']]
process = subprocess.Popen(launch_args, stdout=subprocess.PIPE,
stderr=subprocess.STDOUT, cwd=args['datadir'])
result = process.communicate()[0]
if process.returncode is None or process.returncode != 0:
print "Failed to execute stork_submit.\nThe error was: %s" % result
def storkStart(args):
"""Start Stork """
proc_args = [args['start_bin'],
'-p', args['port'],
'-c', args['configfile']
]
process = subprocess.Popen(proc_args, stderr=subprocess.STDOUT,
stdout=subprocess.PIPE)
time.sleep(3)
print "\n\nStork Server started with pid %s " % process.pid
with open(args['pid'], 'w') as f:
f.write(str(process.pid))
result = process.communicate()[0]
if process.returncode is None or process.returncode != 0:
print "Failed to start Stork Server.\nThe error was: %s" % result
def checkDownloadStatus(args):
"Check if all files have been downloaded! "
job_count = len(args['dest_list'])
os.chdir(args['cwd'])
while job_count > 0:
print "Check if %s files have been downloaded!" % job_count
for filename in args['dest_list']:
log_name = "%s.err" % filename
destination = args['dest_list'][filename]
if os.path.exists(destination):
job_count -= 1
continue
if os.path.exists(destination + '_part') and os.path.exists(log_name):
with open(log_name, 'r') as log_file:
if not log_file.readline().startswith('SUCCESS'):
with open(filename + '.out', 'r') as out_file:
if not out_file.readline().startswith('SUCCESS'):
continue
job_count -= 1
time.sleep(2)
os.rename(destination + '_part', destination)
print "File %s is correctly downloaded!" % destination
else:
print "ERROR!! Check if destination and log_files exist... %s" % destination
time.sleep(5)
\ No newline at end of file
######################################################################
##
## stork_config
##
######################################################################
ENABLE_IPV6 = TRUE
PORT = 9621
NETWORK_INTERFACE = %(ipv4)s
COLLECTOR_HOST = %(ipv4)s:$(PORT)
CONDOR_HOST = %(ipv4)s
RELEASE_DIR = %(releasedir)s
##Stork startup arguments
## Start Stork on a well-known port. Uncomment to simplify connecting to a
## remote Stork server. Note: this interface may change in a future release.
SBIN_DIR = %(releasedir)s/sbin
STORK= $(SBIN_DIR)/stork_server
ARGS = -p $(STORK_PORT) -f -Serverlog $(STORK_LOG_BASE)
## HOST may specify an optional default remote Stork server and port.
#HOST = %(stork_host)s:$(PORT)
HOST = %(ipv4)s:$(PORT)
## When Stork starts up, it can place its address (IP and port) into
## a file. This way, tools running on the local machine don't
## need an additional "-n host:port" command line option. This
## feature can be turned off by commenting out this setting.
STORK_ADDRESS_FILE = $(RELEASE_DIR)/.stork_address
## STORK_LOG_BASE specifies the basename for heritage Stork log files.
## Stork uses this macro to create the following output log files:
## $(STORK_LOG_BASE): Stork server job queue classad collection
## journal file.
## $(STORK_LOG_BASE).history: Used to track completed jobs.
## $(STORK_LOG_BASE).user_log: User level log, also used by DAGMan.
STORK_LOG_BASE= $(RELEASE_DIR)/log)/storkserver.log
STORK_LOG = $(RELEASE_DIR)/log/storklog.log
DEBUG = D_FULLDEBUG
MAX_STORK_LOG = 4000000
## Limits the number of concurrent data placements handled by Stork.
#MAX_NUM_JOBS = 10
## Limits the number of retries for a failed data placement.
#MAX_RETRY = 5
## Limits the run time for a data placement job, after which the
## placement is considered failed.
#MAXDELAY_INMINUTES = 10
## Directory containing Stork binaries
BIN_DIR = %(releasedir)s/bin
## Directory containing Stork transfer modules
MODULE_DIR = %(storkpackage)s/libexec
## Directory to store temporary files and execute transfer modules in
TMP_DIR = $(RELEASE_DIR)/tmp
## Directory in which server state files should be stored (and the directory in
## which the Stork server will execute)
LOG = $(RELEASE_DIR)/log
## Set to true to enable reporting of anonymous usage statistics to the
## Stork developers. This report contains ONLY the version string and
## platform Stork was built for.
## This information helps us improve Stork, so please enable it. :)
ENABLE_STAT_REPORT = TRUE
STAT_REPORT_SERVER = stork.cct.lsu.edu
## Additional values passed to transfer modules.
#RECURSIVE_COPY = FALSE
#VERIFY_CHECKSUM = FALSE
#VERIFY_FILESIZE = FALSE
#NETWORK_CHECK = FALSE
#CHECKPOINT_TRANSFER = TRUE
#FILE_CKPT = TRUE
#SYNC_ONLY = FALSE
#SET_PERMISSIONS = FALSE
#TEST_MODE = 0
#SET_PARALLELISM = 10
SEC_DEFAULT_AUTHENTICATION_METHODS=ANONYMOUS
SEC_CLIENT_AUTHENTICATION_METHODS=ANONYMOUS
SEC_DEFAULT_AUTHENTICATION=NEVER
SEC_READ_AUTHENTICATION=NEVER
SEC_WRITE_AUTHENTICATION=NEVER
SEC_CLIENT_AUTHENTICATION=NEVER
SEC_DAEMON_AUTHENTICATION=NEVER
\ No newline at end of file
######################################################################
##
## stork_config
##
######################################################################
#ENABLE_IPV6 = TRUE
PORT = %(port)s
NETWORK_INTERFACE = %(ipv4)s
COLLECTOR_HOST = %(ipv4)s:$(PORT)
CONDOR_HOST = %(ipv4)s
RELEASE_DIR = %(releasedir)s
##Stork startup arguments
## Start Stork on a well-known port. Uncomment to simplify connecting to a
## remote Stork server. Note: this interface may change in a future release.
SBIN_DIR = %(releasedir)s/sbin
STORK= $(SBIN_DIR)/stork_server
ARGS = -p $(STORK_PORT) -f -Serverlog $(STORK_LOG_BASE)
## HOST may specify an optional default remote Stork server and port.
#HOST = %(stork_host)s:$(PORT)
HOST = %(ipv4)s:$(PORT)
## When Stork starts up, it can place its address (IP and port) into
## a file. This way, tools running on the local machine don't
## need an additional "-n host:port" command line option. This
## feature can be turned off by commenting out this setting.
STORK_ADDRESS_FILE = $(RELEASE_DIR)/.stork_address
## STORK_LOG_BASE specifies the basename for heritage Stork log files.
## Stork uses this macro to create the following output log files:
## $(STORK_LOG_BASE): Stork server job queue classad collection
## journal file.
## $(STORK_LOG_BASE).history: Used to track completed jobs.
## $(STORK_LOG_BASE).user_log: User level log, also used by DAGMan.
STORK_LOG_BASE= $(RELEASE_DIR)/log)/storkserver.log
STORK_LOG = $(RELEASE_DIR)/log/storklog.log
DEBUG = D_FULLDEBUG
MAX_STORK_LOG = 4000000
## Limits the number of concurrent data placements handled by Stork.
#MAX_NUM_JOBS = 10
## Limits the number of retries for a failed data placement.
#MAX_RETRY = 5
## Limits the run time for a data placement job, after which the
## placement is considered failed.
#MAXDELAY_INMINUTES = 10
## Directory containing Stork binaries
BIN_DIR = %(releasedir)s/bin
## Directory containing Stork transfer modules
MODULE_DIR = %(storkpackage)s/libexec
## Directory to store temporary files and execute transfer modules in
TMP_DIR = $(RELEASE_DIR)/tmp
## Directory in which server state files should be stored (and the directory in
## which the Stork server will execute)
LOG = $(RELEASE_DIR)/log
## Set to true to enable reporting of anonymous usage statistics to the
## Stork developers. This report contains ONLY the version string and
## platform Stork was built for.
## This information helps us improve Stork, so please enable it. :)
ENABLE_STAT_REPORT = TRUE
STAT_REPORT_SERVER = stork.cct.lsu.edu
## Additional values passed to transfer modules.
#RECURSIVE_COPY = FALSE
#VERIFY_CHECKSUM = FALSE
#VERIFY_FILESIZE = FALSE
#NETWORK_CHECK = FALSE
#CHECKPOINT_TRANSFER = TRUE
#FILE_CKPT = TRUE
#SYNC_ONLY = FALSE
#SET_PERMISSIONS = FALSE
#TEST_MODE = 0
#SET_PARALLELISM = 10
\ No newline at end of file
[buildout]
parts =
stork_server
stork-submit
tunnel-ipv6-stork
publish-stork-informations
newest = false
offline = true
eggs-directory = ${buildout:eggs-directory}
develop-eggs-directory = ${buildout:develop-eggs-directory}
# Create all needed directories
[rootdirectory]
recipe = slapos.cookbook:mkdirectory
etc = $${buildout:directory}/etc/
var = $${buildout:directory}/var/
stork = $${buildout:directory}/log/
data = $${buildout:directory}/data-jobs/
bin = $${buildout:directory}/bin/
sbin = $${buildout:directory}/sbin/
srv = $${buildout:directory}/srv/
tmp = $${buildout:directory}/tmp/
[basedirectory]
recipe = slapos.cookbook:mkdirectory
log = $${rootdirectory:var}/log/
scripts = $${rootdirectory:etc}/run/
services = $${rootdirectory:etc}/service/
run = $${rootdirectory:var}/run/
backup = $${rootdirectory:srv}/backup/
promises = $${rootdirectory:etc}/promise/
[stork]
recipe = slapos.cookbook:stork
wrapper-path = $${rootdirectory:bin}/stork_raw
ipv6 = $${slap-network-information:global-ipv6}
ipv4 = $${slap-network-information:local-ipv4}
pid = $${basedirectory:run}/stork.pid
package = ${stork:location}
rootdirectory = $${buildout:directory}
data-dir = $${rootdirectory:data}
java-bin = ${java:location}/bin
bin = $${rootdirectory:bin}
sbin = $${rootdirectory:sbin}
log= $${rootdirectory:stork}
tmp= $${rootdirectory:tmp}
dash = ${dash:location}/bin/dash
environment =
LD_LIBRARY_PATH=${libexpat:location}/lib:${openssl:location}/lib:${zlib:location}/lib
PATH=${perl:location}/bin:${globus:location}/bin:${java:location}/bin:${openssl:location}/bin:%(PATH)s
HOSTNAME=$${slap-parameter:stork-host}
#stork user parameter
stork_host = $${slap-parameter:stork-host}
stork_server = $${slap-parameter:stork_server}
stork_port = 9621
machine-role = $${slap-parameter:stork_role}
x509proxy=$${slap-parameter:x509proxy}
[stork_server]
recipe = slapos.cookbook:wrapper
script-file = ${process-svcdeamon:location}/${process-svcdeamon:filename}
command-line = ${buildout:executable} $${:script-file} $${stork:wrapper-path} $${stork:pid} 10
wrapper-path = $${basedirectory:services}/stork_server
[stork-submit]
<= stork
recipe = slapos.cookbook:stork.submit
wrapper-path = $${basedirectory:scripts}/stork_submit
wrapper-check = $${basedirectory:scripts}/stork_check_job
json_src_url = $${slap-parameter:src_data_url}
dest_url = $${slap-parameter:dest_data_url}
data_type=$${slap-parameter:data_type}
src_from_file = false
# Publish all instance parameters (url of instance)
[publish-stork-informations]
recipe = slapos.cookbook:publish
stork_instance_type = $${stork:machine-role}
stork_server = $${slap-parameter:stork_server}
stork_ipv4_address = $${stork:ipv4}
stork_ipv6_address = $${stork:stork_host}
data_type=$${slap-parameter:data_type}
x509proxy=$${slap-parameter:x509proxy}
[tunnel-ipv6-stork]
recipe = slapos.cookbook:ipv6toipv4
ipv6 = $${slap-network-information:global-ipv6}
ipv4 = $${slap-network-information:local-ipv4}
shell-path = ${dash:location}/bin/dash
6tunnel-path = ${6tunnel:location}/bin/6tunnel
ipv6-port = 9621
ipv4-port = 9621
runner-path = $${rootdirectory:srv}/6tunnel-stork
[slap-parameter]
# Default values if not specified
stork-host = [$${slap-network-information:global-ipv6}]
# Role server/client Default is server
stork_server = local
stork_role = client
stork-allowed-write = $${:stork-host}
x509proxy = /tmp/x509up_uXXX
data_type = transfer
src_data_url = {"slapos.tar.gz":"http://git.erp5.org/gitweb/slapos.git/snapshot/c4f5ca68af31cd9d8461869d70928c33a03c5aa6.tar.gz"}
dest_data_url = local
[buildout]
parts =
switch_softwaretype
eggs-directory = ${buildout:eggs-directory}
develop-eggs-directory = ${buildout:develop-eggs-directory}
offline = true
[switch_softwaretype]
recipe = slapos.cookbook:softwaretype
default = ${template-stork:output}
\ No newline at end of file
import os
import subprocess
import time
import signal
import sys
def get_pid(filename):
pid = None
if os.path.exists(filename):
data = open(pid_file).read()
try:
pid = int(data)
except ValueError:
pass
return pid
pid_file = None
def sig_handler(s, frame):
print "Killing on signal %s:" % s,
global pid_file
if pid_file is not None:
pid = get_pid(pid_file)
if pid is not None:
os.kill(pid, signal.SIGTERM)
try:
os.kill(pid, 0)
except Exception:
pass
else:
time.sleep(5)
try:
os.kill(pid, 0)
except Exception:
pass
else:
print 'with SIGKILL...',
os.kill(pid, signal.SIGKILL)
else:
raise ValueError('Pid is none.')
print 'done.'
sys.exit(0)
signal.signal(signal.SIGINT, sig_handler)
signal.signal(signal.SIGQUIT, sig_handler)
signal.signal(signal.SIGTERM, sig_handler)
def svcdaemon(args):
"""Utility script to run daemons in supervisord"""
real_binary = args[0]
global pid_file
pid_file = args[1]
subprocess.check_call(real_binary)
print 'Started %r' % real_binary
while True:
time.sleep(5)
pid = get_pid(pid_file)
if pid is None:
raise ValueError('Pid is none')
os.kill(pid, 0)
if __name__ == '__main__':
args = []
args.append(sys.argv[1])
args.append(sys.argv[2])
if len(sys.argv) > 3:
time.sleep(int(sys.argv[3]))
svcdaemon(args)
exit(0)
\ No newline at end of file
[buildout]
parts =
stork
slapos-cookbook
template
template-stork
slapos.cookbook-repository
check-recipe
extends =
../../component/git/buildout.cfg
../../component/6tunnel/buildout.cfg
../../component/dash/buildout.cfg
../../component/stork/buildout.cfg
../../stack/slapos.cfg
# Local development
[slapos.cookbook-repository]
recipe = slapos.recipe.build:gitclone
repository = http://git.erp5.org/repos/slapos.git
branch = grid-computing
git-executable = ${git:location}/bin/git
[check-recipe]
recipe = plone.recipe.command
stop-on-error = true
update-command = ${:command}
command =
grep parts ${buildout:develop-eggs-directory}/slapos.cookbook.egg-link
[template]
recipe = slapos.recipe.template
url = ${:_profile_base_location_}/instance.cfg
output = ${buildout:directory}/template.cfg
mode = 0644
md5sum = fd88bc6e40bd2f7ecee5ae6d96627420
[template-stork]
recipe = slapos.recipe.template
url = ${:_profile_base_location_}/instance-stork.cfg
output = ${buildout:directory}/template-stork.cfg
md5sum = 553d89e9e9f69b577b5ef15c4179e0fc
mode = 0644
[process-svcdeamon]
recipe = slapos.recipe.download
mode = 0644
md5sum = fd09ea9d1c82981f711b78c6dadd3bad
location = ${buildout:parts-directory}/${:_buildout_section_name_}
url = ${:_profile_base_location_}/scripts/${:filename}
filename = svcdaemon.py
[networkcache]
# signature certificates of the following uploaders.
# Romain Courteaud
# Sebastien Robin
# Kazuhiko Shiozaki
# Cedric de Saint Martin
# Yingjie Xu
# Gabriel Monnerat
# Łukasz Nowak
# Test Agent (Automatic update from tests)
# Alain Takoudjou
signature-certificate-list =
-----BEGIN CERTIFICATE-----
MIIB4DCCA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x40/hhRsyFDR1Gj215g==
-----END CERTIFICATE-----
[versions]
pyparsing = 2.0.2
\ No newline at end of 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