コード例 #1
0
def exp(exp_id=None):
    """ Extract nodes from `exp_id` experiment and set them as commands targets
    Following roles are set:
     * nodes: all the a8 nodes of the experiment
     * frontends: each sites where there are a8 nodes

    """
    username, password = iotlabcli.get_user_credentials()
    api = iotlabcli.Api(username, password)
    exp_id = iotlabcli.get_current_experiment(api, exp_id)

    env.user = username

    nodes = _get_exp_a8_nodes(api, exp_id)
    env.roledefs['nodes'] = nodes

    sites = list(set([url.split('.', 1)[1] for url in nodes]))
    env.roledefs['frontends'] = sites
コード例 #2
0
def query_nodes(api, exp_id=None, nodes_list_list=None, hostname=None):
    """ Get nodes list from experiment and/or nodes_list_list.
    Or currently running experiment if none provided """
    hostname = hostname or HOSTNAME
    nodes_list_list = nodes_list_list or ()
    nodes_list = frozenset(itertools.chain.from_iterable(nodes_list_list))

    nodes = set()
    # no nodes supplied, try to get currently running experiment
    if exp_id is None and not nodes_list:
        exp_id = iotlabcli.get_current_experiment(api)

    # add nodes from experiment, empty if exp_id is None
    nodes.update(get_experiment_nodes(api, exp_id, hostname))
    # add nodes from nodes_list, may be empty
    nodes.update([n.split('.')[0] for n in nodes_list if hostname in n])

    # sorted output for tests
    return sorted(list(nodes))
コード例 #3
0
ファイル: common.py プロジェクト: beshrns/aggregation-tools
def query_nodes(api, exp_id=None, nodes_list_list=None, hostname=None):
    """ Get nodes list from experiment and/or nodes_list_list.
    Or currently running experiment if none provided """
    hostname = hostname or HOSTNAME
    nodes_list_list = nodes_list_list or ()
    nodes_list = frozenset(itertools.chain.from_iterable(nodes_list_list))

    nodes = set()
    # no nodes supplied, try to get currently running experiment
    if exp_id is None and not len(nodes_list):
        exp_id = iotlabcli.get_current_experiment(api)

    # add nodes from experiment, empty if exp_id is None
    nodes.update(get_experiment_nodes(api, exp_id, hostname))
    # add nodes from nodes_list, may be empty
    nodes.update([n.split('.')[0] for n in nodes_list if hostname in n])

    # sorted output for tests
    return sorted(list(nodes))
コード例 #4
0
def main():
    """ Launch serial aggregator and aggregate serial links
    of all nodes.
    """
    parser = opts_parser()
    opts = parser.parse_args()
    api = Api(*get_user_credentials())
    opts.with_a8 = True
    try:
        nodes = SerialAggregator.select_nodes(opts)
    except RuntimeError as err:
        print(err)
        exit(1)
    if opts.experiment_id:
        exp_id = opts.experiment_id
    else:
        exp_id = iotlabcli.get_current_experiment(api)
    print("Running radio logger ...")
    run_radio_logger(exp_id, opts, nodes)