nbgwas_rest/__init__.py
def create_task(params):
    """
    Creates a task by consuming data from request_obj passed in
    and persisting that information to the filesystem under
    JOB_PATH/SUBMIT_DIR/<IP ADDRESS>/UUID with various parameters
    stored in TASK_JSON file and if the 'network' file is set
    that data is dumped to NETWORK_DATA file within the directory
    :param request_obj:
    :return: string that is a uuid which denotes directory name
    """
    params['uuid'] = get_uuid()
    params['tasktype'] = SNP_ANALYZER_TASK
    taskpath = os.path.join(get_submit_dir(), str(params['remoteip']),
                            str(params['uuid']))
    try:
        original_umask = os.umask(0)
        os.makedirs(taskpath, mode=0o775)
    finally:
        os.umask(original_umask)

    # Getting network
    if SNP_LEVEL_SUMMARY_PARAM not in params or \
       params[SNP_LEVEL_SUMMARY_PARAM] is None:
        raise Exception(SNP_LEVEL_SUMMARY_PARAM + ' is required')

    app.logger.debug('snp level summary: ' +
                     str(params[SNP_LEVEL_SUMMARY_PARAM]))
    networkfile_path = os.path.join(taskpath, SNP_LEVEL_SUMMARY_PARAM)
    with open(networkfile_path, 'wb') as f:
        shutil.copyfileobj(params[SNP_LEVEL_SUMMARY_PARAM].stream, f)
        f.flush()
    os.chmod(networkfile_path, mode=0o775)
    params[SNP_LEVEL_SUMMARY_PARAM] = SNP_LEVEL_SUMMARY_PARAM
    app.logger.debug(networkfile_path + ' saved and it is ' +
                     str(os.path.getsize(networkfile_path)) + ' bytes')

    if NDEX_PARAM not in params or params[NDEX_PARAM] is None:
        raise Exception(NDEX_PARAM + ' is required')

    app.logger.debug("Validating ndex id")
    params[NDEX_PARAM] = str(params[NDEX_PARAM]).strip()
    if len(params[NDEX_PARAM]) > 40:
        raise Exception(NDEX_PARAM + ' parameter value is too long to '
                                     'be an NDex UUID')

    tmp_task_json = TASK_JSON + '.tmp'
    taskfilename = os.path.join(taskpath, tmp_task_json)
    with open(taskfilename, 'w') as f:
        json.dump(params, f)
        f.flush()
    os.chmod(taskfilename, mode=0o775)
    shutil.move(taskfilename, os.path.join(taskpath, TASK_JSON))
    return params['uuid']

    Creates a task by consuming data from request_obj passed in
    and persisting that information to the filesystem under
    JOB_PATH/SUBMIT_DIR/<IP ADDRESS>/UUID with various parameters
    stored in TASK_JSON file and if the 'network' file is set
    that data is dumped to NETWORK_DATA file within the directory
    :param request_obj:
    :return: string that is a uuid which denotes directory name
    
Creates a task by consuming data from request_obj passed in
and persisting that information to the filesystem under
JOB_PATH/SUBMIT_DIR//UUID with various parameters
stored in TASK_JSON file and if the 'network' file is set
that data is dumped to NETWORK_DATA file within the directory
Creates a task by consuming data from request_obj passed in and persisting that information to the filesystem under JOB_PATH / SUBMIT_DIR // UUID with various parameters stored in TASK_JSON file and if the ' network ' file is set that data is dumped to NETWORK_DATA file within the directory
def create_task(params):
    params['uuid'] = get_uuid()
    params['tasktype'] = SNP_ANALYZER_TASK
    taskpath = os.path.join(get_submit_dir(), str(params['remoteip']),
                            str(params['uuid']))
    try:
        original_umask = os.umask(0)
        os.makedirs(taskpath, mode=0o775)
    finally:
        os.umask(original_umask)
    if SNP_LEVEL_SUMMARY_PARAM not in params or \
       params[SNP_LEVEL_SUMMARY_PARAM] is None:
        raise Exception(SNP_LEVEL_SUMMARY_PARAM + ' is required')
    app.logger.debug('snp level summary: ' +
                     str(params[SNP_LEVEL_SUMMARY_PARAM]))
    networkfile_path = os.path.join(taskpath, SNP_LEVEL_SUMMARY_PARAM)
    with open(networkfile_path, 'wb') as f:
        shutil.copyfileobj(params[SNP_LEVEL_SUMMARY_PARAM].stream, f)
        f.flush()
    os.chmod(networkfile_path, mode=0o775)
    params[SNP_LEVEL_SUMMARY_PARAM] = SNP_LEVEL_SUMMARY_PARAM
    app.logger.debug(networkfile_path + ' saved and it is ' +
                     str(os.path.getsize(networkfile_path)) + ' bytes')
    if NDEX_PARAM not in params or params[NDEX_PARAM] is None:
        raise Exception(NDEX_PARAM + ' is required')
    app.logger.debug("Validating ndex id")
    params[NDEX_PARAM] = str(params[NDEX_PARAM]).strip()
    if len(params[NDEX_PARAM]) > 40:
        raise Exception(NDEX_PARAM + ' parameter value is too long to '
                                     'be an NDex UUID')
    tmp_task_json = TASK_JSON + '.tmp'
    taskfilename = os.path.join(taskpath, tmp_task_json)
    with open(taskfilename, 'w') as f:
        json.dump(params, f)
        f.flush()
    os.chmod(taskfilename, mode=0o775)
    shutil.move(taskfilename, os.path.join(taskpath, TASK_JSON))
    return params['uuid']
def create_task ( params ) : params [ 'uuid' ] = get_uuid ( ) params [ 'tasktype' ] = SNP_ANALYZER_TASK taskpath = os . path . join ( get_submit_dir ( ) , str ( params [ 'remoteip' ] ) , str ( params [ 'uuid' ] ) ) try : original_umask = os . umask ( 0 ) os . makedirs ( taskpath , mode = 0o775 ) finally : os . umask ( original_umask ) if SNP_LEVEL_SUMMARY_PARAM not in params or params [ SNP_LEVEL_SUMMARY_PARAM ] is None : raise Exception ( SNP_LEVEL_SUMMARY_PARAM + ' is required' ) app . logger . debug ( 'snp level summary: ' + str ( params [ SNP_LEVEL_SUMMARY_PARAM ] ) ) networkfile_path = os . path . join ( taskpath , SNP_LEVEL_SUMMARY_PARAM ) with open ( networkfile_path , 'wb' ) as f : shutil . copyfileobj ( params [ SNP_LEVEL_SUMMARY_PARAM ] . stream , f ) f . flush ( ) os . chmod ( networkfile_path , mode = 0o775 ) params [ SNP_LEVEL_SUMMARY_PARAM ] = SNP_LEVEL_SUMMARY_PARAM app . logger . debug ( networkfile_path + ' saved and it is ' + str ( os . path . getsize ( networkfile_path ) ) + ' bytes' ) if NDEX_PARAM not in params or params [ NDEX_PARAM ] is None : raise Exception ( NDEX_PARAM + ' is required' ) app . logger . debug ( "Validating ndex id" ) params [ NDEX_PARAM ] = str ( params [ NDEX_PARAM ] ) . strip ( ) if len ( params [ NDEX_PARAM ] ) > 40 : raise Exception ( NDEX_PARAM + ' parameter value is too long to ' 'be an NDex UUID' ) tmp_task_json = TASK_JSON + '.tmp' taskfilename = os . path . join ( taskpath , tmp_task_json ) with open ( taskfilename , 'w' ) as f : json . dump ( params , f ) f . flush ( ) os . chmod ( taskfilename , mode = 0o775 ) shutil . move ( taskfilename , os . path . join ( taskpath , TASK_JSON ) ) return params [ 'uuid' ]
Creates a task by consuming data from request_obj passed in
and persisting that information to the filesystem under
JOB_PATH/SUBMIT_DIR/<IP ADDRESS>/UUID with various parameters
stored in TASK_JSON file and if the 'network' file is set
that data is dumped to NETWORK_DATA file within the directory
Creates a task by consuming data from request_obj passed in and persisting that information to the filesystem under JOB_PATH / SUBMIT_DIR / <IP ADDRESS > / UUID with various parameters stored in TASK_JSON file and if the ' network ' file is set that data is dumped to NETWORK_DATA file within the directory
"""
    Creates a task by consuming data from request_obj passed in
    and persisting that information to the filesystem under
    JOB_PATH/SUBMIT_DIR/<IP ADDRESS>/UUID with various parameters
    stored in TASK_JSON file and if the 'network' file is set
    that data is dumped to NETWORK_DATA file within the directory
    :param request_obj:
    :return: string that is a uuid which denotes directory name
    """ # Getting network
string that is a uuid which denotes directory name
string that is a uuid which denotes directory name
params
request_obj
None