Exemple #1
0
def create_ps3_resource(sandboxkey):
    resource_name = 'ps3live'
    mig_user = '******'
    hosturl = 'ps3live'
    resource_home = '/opt/mig/data/MiG/mig_frontend/'
    script_language = 'sh'
    ssh_port = -1
    memory = 128

    # disk = 0.064

    disk = 0
    cpucount = 1
    sandbox = True
    arch = 'PS3'
    nodecount = 1
    hostkey = 'N/A'
    frontend_node = 'localhost'

    frontend_log = '/dev/null'
    if debug:
        frontend_log = '/opt/mig/data/MiG/mig_frontend/frontendlog'

    exe_name = 'localhost'
    exe_nodecount = 1
    exe_cputime = 100000
    exe_execution_precondition = '""'
    exe_prepend_execute = '""'

    exe_exehostlog = '/dev/null'
    if debug:
        exe_exehostlog = '/opt/mig/data/MiG/mig_exe/exechostlog'

    exe_joblog = '/dev/null'
    if debug:
        exe_joblog = '/opt/mig/data/MiG/mig_exe/joblog'

    exe_execution_user = '******'
    exe_execution_node = 'localhost'
    exe_execution_dir = '/opt/mig/data/MiG/mig_exe/'
    exe_start_command = \
        'cd /opt/mig/data/MiG/mig_exe/; chmod 700 master_node_script_ps3.sh; ./master_node_script_ps3.sh'
    exe_status_command = 'N/A'
    exe_stop_command = 'kill -9 -$mig_exe_pgid'
    exe_clean_command = 'N/A'
    exe_continuous = False
    exe_shared_fs = True
    exe_vgrid = default_vgrid

    result = create_resource_home(configuration, sandboxkey, resource_name)

    if not result[0]:
        o.out(result[1])
        cgiscript_header()
        o.reply_and_exit(o.ERROR)

    resource_identifier = result[1]
    unique_resource_name = resource_name + '.'\
         + str(resource_identifier)

    # create a resource configuration string that we can write to a file

    res_conf_string = \
        """ \
::MIGUSER::
%s

::HOSTURL::
%s

::HOSTIDENTIFIER::
%s

::RESOURCEHOME::
%s

::SCRIPTLANGUAGE::
%s

::SSHPORT::
%s

::MEMORY::
%s

::DISK::
%s

::CPUCOUNT::
%s

::SANDBOX::
%s

::SANDBOXKEY::
%s    
    
::ARCHITECTURE::
%s

::NODECOUNT::
%s

::RUNTIMEENVIRONMENT::

::HOSTKEY::
%s

::FRONTENDNODE::
%s

::FRONTENDLOG::
%s

::EXECONFIG::
name=%s
nodecount=%s
cputime=%s
execution_precondition=%s
prepend_execute=%s
exehostlog=%s
joblog=%s
execution_user=%s
execution_node=%s
execution_dir=%s
start_command=%s
status_command=%s
stop_command=%s
clean_command=%s
continuous=%s
shared_fs=%s
vgrid=%s"""\
         % (
        mig_user,
        hosturl,
        resource_identifier,
        resource_home,
        script_language,
        str(ssh_port),
        str(memory),
        str(disk),
        str(cpucount),
        str(sandbox),
        sandboxkey,
        arch,
        str(nodecount),
        hostkey,
        frontend_node,
        frontend_log,
        exe_name,
        str(exe_nodecount),
        str(exe_cputime),
        exe_execution_precondition,
        exe_prepend_execute,
        exe_exehostlog,
        exe_joblog,
        exe_execution_user,
        exe_execution_node,
        exe_execution_dir,
        exe_start_command,
        exe_status_command,
        exe_stop_command,
        exe_clean_command,
        str(exe_continuous),
        str(exe_shared_fs),
        exe_vgrid,
        )

    # write the conf string to a conf file

    conf_file_src = os.path.join(configuration.resource_home,
                                 unique_resource_name, 'config.MiG')
    try:
        fd = open(conf_file_src, 'w')
        fd.write(res_conf_string)
        fd.close()
    except Exception, e:
        o.out(e)
        o.reply_and_exit(o.ERROR)
Exemple #2
0
def create_ps3_resource(configuration, sandboxkey):
    resource_name = 'ps3live'
    mig_user = '******'
    hosturl = 'ps3live'
    resource_home = '/opt/mig/data/MiG/mig_frontend/'
    script_language = 'sh'
    ssh_port = 22
    memory = 128

    # disk = 0.064

    disk = 0
    cpucount = 1
    sandbox = True
    arch = 'PS3'
    nodecount = 1
    hostkey = ''
    frontend_node = 'localhost'

    frontend_log = '/dev/null'
    if debug:
        frontend_log = '/opt/mig/data/MiG/mig_frontend/frontendlog'

    exe_name = 'localhost'
    exe_nodecount = 1
    exe_cputime = 100000
    exe_execution_precondition = '""'
    exe_prepend_execute = '""'

    exe_exehostlog = '/dev/null'
    if debug:
        exe_exehostlog = '/opt/mig/data/MiG/mig_exe/exechostlog'

    exe_joblog = '/dev/null'
    if debug:
        exe_joblog = '/opt/mig/data/MiG/mig_exe/joblog'

    exe_execution_user = '******'
    exe_execution_node = 'localhost'
    exe_execution_dir = '/opt/mig/data/MiG/mig_exe/'
    exe_start_command = \
        'cd /opt/mig/data/MiG/mig_exe/; chmod 700 master_node_script_ps3.sh; ./master_node_script_ps3.sh'
    exe_status_command = 'NA'
    exe_stop_command = 'kill -9 -$mig_exe_pgid'
    exe_clean_command = 'NA'
    exe_continuous = False
    exe_shared_fs = True
    exe_vgrid = default_vgrid

    result = create_resource_home(configuration, sandboxkey, resource_name)

    if not result[0]:
        o.out(result[1])
        cgiscript_header()
        o.reply_and_exit(o.ERROR)

    resource_identifier = result[1]
    unique_resource_name = resource_name + '.'\
         + str(resource_identifier)

    # create a resource configuration string that we can write to a file

    res_conf_string = \
        """ \
::MIGUSER::
%s

::HOSTURL::
%s

::HOSTIDENTIFIER::
%s

::RESOURCEHOME::
%s

::SCRIPTLANGUAGE::
%s

::SSHPORT::
%s

::MEMORY::
%s

::DISK::
%s

::CPUCOUNT::
%s

::SANDBOX::
%s

::SANDBOXKEY::
%s    
    
::ARCHITECTURE::
%s

::NODECOUNT::
%s

::RUNTIMEENVIRONMENT::

::HOSTKEY::
%s

::FRONTENDNODE::
%s

::FRONTENDLOG::
%s

::EXECONFIG::
name=%s
nodecount=%s
cputime=%s
execution_precondition=%s
prepend_execute=%s
exehostlog=%s
joblog=%s
execution_user=%s
execution_node=%s
execution_dir=%s
start_command=%s
status_command=%s
stop_command=%s
clean_command=%s
continuous=%s
shared_fs=%s
vgrid=%s"""\
         % (
        mig_user,
        hosturl,
        resource_identifier,
        resource_home,
        script_language,
        str(ssh_port),
        str(memory),
        str(disk),
        str(cpucount),
        str(sandbox),
        sandboxkey,
        arch,
        str(nodecount),
        hostkey,
        frontend_node,
        frontend_log,
        exe_name,
        str(exe_nodecount),
        str(exe_cputime),
        exe_execution_precondition,
        exe_prepend_execute,
        exe_exehostlog,
        exe_joblog,
        exe_execution_user,
        exe_execution_node,
        exe_execution_dir,
        exe_start_command,
        exe_status_command,
        exe_stop_command,
        exe_clean_command,
        str(exe_continuous),
        str(exe_shared_fs),
        exe_vgrid,
        )

    # write the conf string to a conf file

    conf_file_src = os.path.join(configuration.resource_home,
                                 unique_resource_name, 'config.MiG')
    try:
        fd = open(conf_file_src, 'w')
        fd.write(res_conf_string)
        fd.close()
    except Exception, e:
        o.out(e)
        o.reply_and_exit(o.ERROR)
Exemple #3
0

# ## Main ###
# Get Quirystring object

fieldstorage = cgi.FieldStorage()
(logger, configuration, client_id, o) = \
    init_cgiscript_possibly_with_cert()

# Check we are using GET method

if os.getenv('REQUEST_METHOD') != 'GET':

    # Request method is not GET

    cgiscript_header()
    o.out('You must use HTTP GET!')
    o.reply_and_exit(o.ERROR)

# Make sure that we're called with HTTPS.

if str(os.getenv('HTTPS')) != 'on':
    o.out('Please use HTTPS with session id for authenticating job requests!'
          )
    cgiscript_header()
    o.reply_and_exit(o.ERROR)

action = fieldstorage.getfirst('action', None)
debug = fieldstorage.getfirst('debug', None)
if action == 'get_frontend_script':
    (status, msg) = get_ps3_resource()
Exemple #4
0

# ## Main ###
# Get Quirystring object

fieldstorage = cgi.FieldStorage()
(logger, configuration, client_id, o) = \
    init_cgiscript_possibly_with_cert()

# Check we are using GET method

if os.getenv('REQUEST_METHOD') != 'GET':

    # Request method is not GET

    cgiscript_header()
    o.out('You must use HTTP GET!')
    o.reply_and_exit(o.ERROR)

# Make sure that we're called with HTTPS.

if str(os.getenv('HTTPS')) != 'on':
    o.out('Please use HTTPS with session id for authenticating job requests!')
    cgiscript_header()
    o.reply_and_exit(o.ERROR)

action = fieldstorage.getfirst('action', None)
debug = fieldstorage.getfirst('debug', None)
if action == 'get_frontend_script':
    (status, msg) = get_ps3_resource(configuration)
    if status: