def workdirs_from_suite_id(suite_id):
    # print('Simulation working directories for SuiteId = %s' % suite_id)
    s = Suite.get(suite_id)
    exps = s.get_experiments(QueryCriteria().select('id'))
    sims = []
    for e in exps:
        sims.extend(sims_from_experiment(e))
    return workdirs_from_simulations(sims)
def createSimDirectoryMap_suite(sname):

    #from simtools.OutputParser import CompsDTKOutputParser
    from COMPS.Data import Suite, QueryCriteria
    from simtools.Utilities.Experiments import retrieve_experiment
    from COMPS import Client
    Client.login('https://comps.idmod.org')

    ste = Suite.get(sname)
    expts = ste.get_experiments()
    tagstemp = []
    simidstemp = []

    for exp in expts:
        expt = retrieve_experiment(str(exp.id))
        tagstemp.append([x.tags for x in expt.simulations])
        simidstemp.append([x.id for x in expt.simulations])
    tags = [item for sublist in tagstemp for item in sublist]
    simids = [item for sublist in simidstemp for item in sublist]
    df = pd.DataFrame(tags)
    df['simid'] = simids

    """
    sdf = get_status(expname)

    if not (sdf['status'].str.contains('Succeeded')).all() :
        print 'Warning: not all jobs in %s succeeded' % expname, ':',
        print len(sdf[sdf['status'] != 'Succeeded']), 'unsucceeded'
        df = pd.merge(left=df, right=sdf, on='simid')
        df = df[df['status'] == 'Succeeded']

        e = Experiment.get(expt.exp_id)
        sims = e.get_simulations(QueryCriteria().select(['id', 'state']).where('state=Succeeded').select_children('hpc_jobs'))
        sdf = pd.DataFrame( { 'simid' : [x.id for x in sims],
                              'outpath' : [x.hpc_jobs[-1].working_directory for x in sims] } )
        sdf['simid'] = sdf['simid'].astype(unicode)
        df = pd.merge(left=df, right=sdf, on='simid')
    else :
    """
    df['outpath'] = pd.Series([x.get_path() for x in expt.simulations])

    return df
Beispiel #3
0
    new_experiment = Experiment(name=experiment.name, suite_id=to_suite.id)
    new_experiment.set_tags({CopiedFromExperiment experiment.id})
    new_experiment.save()
    return new_experiment


if __name__ == __main__
    from simtools.Utilities.COMPSUtilities import exps_for_suite_id, sims_from_experiment_id
    from simtools.Utilities.Experiments import retrieve_experiment
    from simtools.ExperimentManager.ExperimentManagerFactory import ExperimentManagerFactory
    from simtools.ExperimentManager.BaseExperimentManager import BaseExperimentManager

    SetupParser.init()

    # load the original stuff
    original_suite = Suite.get(id=original_suite_id)
    original_experiments = exps_for_suite_id(original_suite_id)

    # start making the new stuff
    exp_manager = ExperimentManagerFactory.init()
    suite_id = exp_manager.create_suite(suite_name=original_suite.name)
    new_suite = Suite.get(id=suite_id)

    new_experiments = []
    for original_experiment in original_experiments
        new_experiment = copy_experiment(experiment=original_experiment, to_suite=new_suite)
        new_experiments.append(new_experiment)

        # simulation level items to set
        original_simulations = sims_from_experiment_id(exp_id=original_experiment.id)
        for original_simulation in original_simulations
    def create_suite(suite_name):
        suite = Suite(suite_name)
        suite.save()

        return str(suite.id)
def delete_suite(suite_id):
    try:
        s = Suite.get(suite_id)
        s.delete()
    except Exception as e:
        print("Could not delete suite %s" % suite_id)