Beispiel #1
0
def main():

    """
    Relevant ticket : http://team.ceda.ac.uk/trac/ceda/ticket/23204
    """

    start = datetime.datetime.now()
    print "==============================="
    print "Script started at: %s." % (str(start))

    # Gets command line arguments.
    com_args = util.sanitise_args(docopt(__doc__, version=__version__))

    # Sets default values and determione what operations the script will perform.
    status_and_defaults = get_stat_and_defs(com_args)

    config_file = status_and_defaults[0]
    run_status = status_and_defaults[1]
    scan_status = status_and_defaults[2]

    # Calls appropriate functions.
    if run_status == constants.Script_status.RUN_SCRIPT_IN_LOTUS:
        scan_datasets_in_lotus(config_file, scan_status)
    elif run_status == constants.Script_status.RUN_SCRIPT_IN_LOCALHOST:
        scan_datasets_in_localhost(config_file, scan_status)
    else:
        print "Some options could not be recognized.\n"

    end = datetime.datetime.now()
    print "Script ended at : %s  it ran for : %s." % (str(end), str(end - start))
    print "==============================="
Beispiel #2
0
def main():

    """
    Relevant ticket : http://team.ceda.ac.uk/trac/ceda/ticket/23217
    """

    #Get command line arguments.
    com_args = util.sanitise_args(docopt(__doc__, version=__version__))

    #Insert defaults
    status_and_defaults = get_stat_and_defs(com_args)



    start = datetime.datetime.now()
    print "Script started at: %s" %(str(start))

    status = status_and_defaults[1]
    config = status_and_defaults[0]


    if status == constants.Script_status.RUN_SCRIPT_IN_LOCALHOST:
        store_datasets_to_files_in_localhost(status, config)
    else:
        store_datasets_to_files_in_lotus(status, config)


    end = datetime.datetime.now()
    print "Script ended at : %s it ran for : %s" %(str(end), str(end - start))
Beispiel #3
0
def main():

    """
    Relevant ticket : http://team.ceda.ac.uk/trac/ceda/ticket/23235
    """
    #Get command line arguments.
    com_args = util.sanitise_args(docopt(__doc__, version=__version__))
    start = datetime.datetime.now()
    print "Script started at: {}".format(str(start))

    res = parse_logs(com_args)
    validate_results(res)
    print_dict(res)

    end = datetime.datetime.now()
    print "\nScript ended at : {} it ran for : {}".format(str(end), str(end - start))
def main():

    start = datetime.datetime.now()
    print "==============================="
    print "Script started at: %s." %(str(start))


    #Gets command line arguments.
    com_args = util.sanitise_args(docopt(__doc__, version=__version__))

    commands_file = com_args["filename"]
    num_processes = com_args["num-processes"]

    util.run_tasks_file_in_lotus(commands_file, int(num_processes), user_wait_time=None, logger=None)

    end = datetime.datetime.now()
    print "Script ended at : %s  it ran for : %s." \
          %(str(end), str(end - start))
    print "==============================="
Beispiel #5
0
def main():

    """
    Relevant ticket : http://team.ceda.ac.uk/trac/ceda/ticket/23203
    """
    #Get command line arguments.
    com_args = util.sanitise_args(docopt(__doc__, version=__version__))

    #Insert defaults
    status_and_defaults = get_stat_and_defs(com_args)

    config = status_and_defaults[0]
    status = status_and_defaults[1]

    #checks the validity of command line arguments.
    try:
        ckeck_com_args_validity(config, status)
    except ValueError as err:
        print err
        return


    start = datetime.datetime.now()
    print "Script started at: %s" %(str(start))


    #Manage the options given.
    if status == constants.Script_status.STORE_DATASET_TO_FILE:
        store_dataset_to_file(config, status)
    elif status == constants.Script_status.READ_AND_SCAN_DATASET:
        read_and_scan_dataset(config, status)
    elif status == constants.Script_status.READ_DATASET_FROM_FILE_AND_SCAN:
        read_dataset_from_file_and_scan(config, status)

    end = datetime.datetime.now()
    print "Script ended at : %s it ran for : %s" %(str(end), str(end - start))
def process_obs_to_html(dataset_file):
    """
    Looks up each Observation in the MOLES catalogue, matches phenomena to it 
    from ES and then writes HTML pages listing them. 
    """
    lines = util.read_file_into_list(dataset_file)
    summary_info = []
    counter = 0
    for line in lines:
        path = line.split("=")[1].rstrip()
        try:
            print "searching path {}".format(path)
            results = fbs_api.get_dir_info(path)
        except:
            continue

        #if len(results["formats"]) > 0:
            #print "Formats in directory {} are {} and some files {}".format(data_path, results["formats"], results["sample_names"])
        record = (line, results["formats"], results["sample_names"])
        summary_info.append(record)
        #counter += 1
        #if counter >10:
        #    break

    print create_html_table(summary_info)

if __name__ == "__main__":
    com_args = util.sanitise_args(docopt(__doc__))
    process_obs_to_html(com_args["filename"])