diff options
author | Neil Williams <neil.williams@linaro.org> | 2015-07-01 14:15:21 +0100 |
---|---|---|
committer | Neil Williams <neil.williams@linaro.org> | 2015-07-01 14:15:21 +0100 |
commit | dd97fa579181ce308ad4d8d37945548be5f5e969 (patch) | |
tree | 88c3607d647fa7c710e401d8efddc52ea40f17a7 | |
parent | 7923c96b3bfd86e91d7311e9a563baf647536019 (diff) |
Allow for device names to not include the type name
Re-use existing data to build a set declaring the
type of each visible device and then base the list
of online_device_types on that set, not whether the
type name exists in the device hostname.
Change-Id: I2a44bbb960cda320be63db2776c989cd7852381c
-rw-r--r-- | lava-job-runner.py | 32 |
1 files changed, 7 insertions, 25 deletions
diff --git a/lava-job-runner.py b/lava-job-runner.py index 0d932ea..e94bc73 100644 --- a/lava-job-runner.py +++ b/lava-job-runner.py @@ -147,10 +147,9 @@ def submit_jobs(connection, server, bundle_stream): def submit_yaml_jobs(connection, server, bundle_stream=None): online_devices, offline_devices = gather_pipeline_devices(connection) - online_device_types, offline_device_types = gather_device_types(connection) - print "Submitting pipeline dispatcher jobs to Server..." - print "Device types:", ", ".join(online_device_types) - print "Devices:", ", ".join(online_devices) + print "Pipeline devices:", ", ".join(online_devices) + device_types = connection.system.user_can_view_devices(online_devices.keys()) + print "Device_types of available devices:", device_types.keys() for job in yaml_map: try: with open(job, 'rb') as stream: @@ -163,26 +162,9 @@ def submit_yaml_jobs(connection, server, bundle_stream=None): if 'device_type' not in job_info: print "Skipping job %s - missing device_type declaration." % job continue - if job_info['device_type'] in offline_device_types: - print "All devices of type: %s are OFFLINE, skipping..." % job_info['device_type'] - print os.path.basename(job) + ' : skip' - elif job_info['device_type'] in online_device_types: - devices = [item for item in online_devices if job_info['device_type'] in item] - pipeline_data = connection.system.user_can_view_devices(devices) - if job_info['device_type'] not in pipeline_data: - continue - for device_data in pipeline_data[job_info['device_type']]: - for key, value in device_data.items(): - if value['is_pipeline']: - submit = True - break - if submit: - break - if submit: - yaml_map[job] = connection.scheduler.submit_job(job_data) - else: - print "No %s device-type available on server, skipping..." % job_info['device_type'] - print os.path.basename(job) + ' : skip' + if job_data['device_type'] in device_types.keys(): + print "Submitting pipeline job to", job_data['device_type'] + yaml_map[job] = connection.scheduler.submit_job(job_data) except (xmlrpclib.ProtocolError, xmlrpclib.Fault, IOError, ValueError, yaml.YAMLError) as e: print "YAML VALIDATION ERROR!" @@ -258,7 +240,7 @@ def gather_pipeline_devices(connection): submit = True break if submit: - if device[2] in ['going offline', 'offline']: + if device[2] in ['going offline', 'offline', 'retired']: offline_devices[device[0]] = 1 else: online_devices[device[0]] = 1 |