forked from iot-lab/cli-tools
/
robot.py
36 lines (31 loc) · 1.38 KB
/
robot.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
# -*- coding:utf-8 -*-
# This file is a part of IoT-LAB cli-tools
# Copyright (C) 2015 INRIA (Contact: admin@iot-lab.info)
# Contributor(s) : see AUTHORS file
#
# This software is governed by the CeCILL license under French law
# and abiding by the rules of distribution of free software. You can use,
# modify and/ or redistribute the software under the terms of the CeCILL
# license as circulated by CEA, CNRS and INRIA at the following URL
# http://www.cecill.info.
#
# As a counterpart to the access to the source code and rights to copy,
# modify and redistribute granted by the license, users are provided only
# with a limited warranty and the software's author, the holder of the
# economic rights, and the successive licensors have only limited
# liability.
#
# The fact that you are presently reading this means that you have had
# knowledge of the CeCILL license and that you accept its terms.
""" Implement the 'robot' requests """
def robot_command(api, command, exp_id, nodes_list=()):
""" Launch commands ('status',) on nodes_list
:param api: API Rest api object
:param command: command that should be run
:param exp_id: Target experiment id
:param nodes_list: List of nodes where to run command.
Empty list runs on all nodes
"""
assert command in ('status',)
result = api.robot_command(command, exp_id, nodes_list)
return result