Example #1
0
def startup_script(opts, conf, istore_dev):
    login_dir = "/root"

    head = "#!/bin/bash\n"

    # use EC2 instance store on render farm instance?
    use_istore = int(conf.get('USE_ISTORE', '1' if istore_dev else '0'))

    if use_istore:
        # script to start brenda-node running
        # on the EC2 instance store
        iswd = conf.get('WORK_DIR', '/mnt/brenda')
        if iswd != login_dir:
            head += """\
# run Brenda on the EC2 instance store volume
B="%s"
if ! [ -d "$B" ]; then
  for f in brenda.pid log task_count task_last DONE ; do
    ln -s "$B/$f" "%s/$f"
  done
fi
export BRENDA_WORK_DIR="."
mkdir -p "$B"
cd "$B"
""" % (iswd, login_dir)
        else:
            head += 'cd "%s"\n' % (login_dir, )
    else:
        head += 'cd "%s"\n' % (login_dir, )

    head += "/usr/local/bin/brenda-node --daemon <<EOF\n"
    tail = "EOF\n"
    keys = [
        'AWS_ACCESS_KEY', 'AWS_SECRET_KEY', 'BLENDER_PROJECT', 'WORK_QUEUE',
        'RENDER_OUTPUT'
    ]
    optional_keys = [
        "S3_REGION", "SQS_REGION", "CURL_MAX_THREADS", "CURL_N_RETRIES",
        "CURL_DEBUG", "VISIBILITY_TIMEOUT", "VISIBILITY_TIMEOUT_REASSERT",
        "N_RETRIES", "ERROR_PAUSE", "RESET_PERIOD",
        "BLENDER_PROJECT_ALWAYS_REFETCH", "WORK_DIR", "SHUTDOWN", "DONE"
    ] + list(aws.additional_ebs_iterator(conf))

    script = head
    for k in keys:
        v = conf.get(k)
        if not v:
            raise ValueError("config key %r must be defined" % (k, ))
        script += "%s=%s\n" % (k, v)
    for k in optional_keys:
        if k == "WORK_DIR" and use_istore:
            continue
        v = conf.get(k)
        if v:
            script += "%s=%s\n" % (k, v)
    script += tail
    return script
Example #2
0
def startup_script(opts, conf, istore_dev):
    def addInfo():

        return """\
echo user
echo ----
whoami
echo current location
echo ----------------
pwd
echo environment variables:
echo ----------------------
printenv
echo ----------------------
"""

    login_dir = "/home/ubuntu"

    head = "#!/bin/bash\n"
    head += addInfo()

    #    Pre-run script?
    startup_prerun = conf.get('STARTUP_PRERUN', False)
    if startup_prerun:
        head += startup_prerun + "\n"

    head += addInfo()

    #    use EC2 instance store on render farm instance?
    use_istore = int(conf.get('USE_ISTORE', '1' if istore_dev else '0'))

    if use_istore:
        #    script to start brenda-node running
        #    on the EC2 instance store
        iswd = conf.get('WORK_DIR', '/mnt/brenda')
        if iswd != login_dir:
            head += """\
# run Brenda on the EC2 instance store volume
B="%s"
if ! [ -d "$B" ]; then
  for f in brenda.pid log task_count task_last DONE ; do
    ln -s "$B/$f" "%s/$f"
  done
fi
export BRENDA_WORK_DIR="."
# export BLENDER_USER_CONFIG=/CustomSoftware/BlenderPrefs/UserConfigs/Rainer/
# export BLENDER_USER_SCRIPTS=/CustomSoftware/BlenderPrefs/scripts/
# export OCIO=/CustomSoftware/filmic-blender/config.ocio
mkdir -p "$B"
cd "$B"
""" % (iswd, login_dir)
        else:
            head += 'cd "%s"\n' % (login_dir, )
    else:
        head += 'cd "%s"\n' % (login_dir, )

    head += addInfo()

    head += "/usr/local/bin/brenda-node --daemon <<EOF\n"
    tail = "EOF\n"
    keys = [
        'AWS_ACCESS_KEY',
        'AWS_SECRET_KEY',
    ]
    optional_keys = [
        "BLENDER_PROJECT", "WORK_QUEUE", "RENDER_OUTPUT", "EC2_REGION",
        "S3_REGION", "SQS_REGION", "CURL_MAX_THREADS", "CURL_N_RETRIES",
        "CURL_DEBUG", "VISIBILITY_TIMEOUT", "VISIBILITY_TIMEOUT_REASSERT",
        "N_RETRIES", "ERROR_PAUSE", "RESET_PERIOD",
        "BLENDER_PROJECT_ALWAYS_REFETCH", "WORK_DIR", "SHUTDOWN", "DONE"
    ] + list(aws.additional_ebs_iterator(conf))

    script = head
    for k in keys:
        v = conf.get(k)
        if not v:
            raise ValueError("config key %r must be defined" % (k, ))
        script += "%s=%s\n" % (k, v)
    for k in optional_keys:
        if k == "WORK_DIR" and use_istore:
            continue
        v = conf.get(k)
        if v:
            script += "%s=%s\n" % (k, v)

    script += addInfo()

    script += tail
    return script
Example #3
0
File: run.py Project: meigo/brenda
def startup_script(opts, conf, istore_dev):
    login_dir = "/root"

    head = "#!/bin/bash\n"

    # use EC2 instance store on render farm instance?
    use_istore = int(conf.get('USE_ISTORE', '1' if istore_dev else '0'))

    if use_istore:
        # script to start brenda-node running
        # on the EC2 instance store
        iswd = conf.get('WORK_DIR', '/mnt/brenda')
        if iswd != login_dir:
            head += """\
# run Brenda on the EC2 instance store volume
B="%s"
if ! [ -d "$B" ]; then
  for f in brenda.pid log task_count task_last DONE ; do
    ln -s "$B/$f" "%s/$f"
  done
fi
export BRENDA_WORK_DIR="."
mkdir -p "$B"
cd "$B"
""" % (iswd, login_dir)
        else:
            head += 'cd "%s"\n' % (login_dir,)
    else:
        head += 'cd "%s"\n' % (login_dir,)

    head += "/usr/local/bin/brenda-node --daemon <<EOF\n"
    tail = "EOF\n"
    keys = [
        'AWS_ACCESS_KEY',
        'AWS_SECRET_KEY',
        'BLENDER_PROJECT',
        'WORK_QUEUE',
        'RENDER_OUTPUT'
        ]
    optional_keys = [
        "S3_REGION",
        "SQS_REGION",
        "CURL_MAX_THREADS",
        "CURL_N_RETRIES",
        "CURL_DEBUG",
        "VISIBILITY_TIMEOUT",
        "VISIBILITY_TIMEOUT_REASSERT",
        "N_RETRIES",
        "ERROR_PAUSE",
        "RESET_PERIOD",
        "BLENDER_PROJECT_ALWAYS_REFETCH",
        "WORK_DIR",
        "SHUTDOWN",
        "DONE"
        ] + list(aws.additional_ebs_iterator(conf))

    script = head
    for k in keys:
        v = conf.get(k)
        if not v:
            raise ValueError("config key %r must be defined" % (k,))
        script += "%s=%s\n" % (k, v)
    for k in optional_keys:
        if k == "WORK_DIR" and use_istore:
            continue
        v = conf.get(k)
        if v:
            script += "%s=%s\n" % (k, v)
    script += tail
    return script