Home | History | Annotate | Download | only in afe

Lines Matching refs:labels

96 # labels
196 Yet another method to create labels.
304 labels = models.Label.query_objects(filter_data)
306 labels = labels.exclude(**exclude_filter)
309 return rpc_utils.prepare_rows_as_nested_dicts(labels, ())
315 non_static_lists = rpc_utils.prepare_rows_as_nested_dicts(labels, ())
318 label_ids = [label.id for label in labels]
321 replaced_label_names = {l.name for l in labels if l.id in replaced_ids}
470 def add_labels_to_host(id, labels):
471 """Adds labels to a given host only in local DB.
474 @param labels: ids or names for labels.
476 label_objs = models.Label.smart_get_bulk(labels)
478 models.Host.smart_get(id).labels.add(*label_objs)
484 host.labels.add(*non_static_labels)
488 def host_add_labels(id, labels):
489 """Adds labels to a given host.
492 @param labels: ids or names for labels.
496 # Create the labels on the master/shards.
497 for label in labels:
500 label_objs = models.Label.smart_get_bulk(labels)
505 {'labels': ('Adding more than one platform: %s' %
511 if any(label_name.startswith('board:') for label_name in labels):
512 models.Host.check_board_labels_allowed([host_obj], labels)
513 add_labels_to_host(id, labels)
516 id=id, labels=labels)
519 def remove_labels_from_host(id, labels):
520 """Removes labels from a given host only in local DB.
523 @param labels: ids or names for labels.
525 label_objs = models.Label.smart_get_bulk(labels)
527 models.Host.smart_get(id).labels.remove(*label_objs)
532 host.labels.remove(*non_static_labels)
534 logging.info('Cannot remove labels "%r" for host "%r" due to they '
535 'are static labels. Use '
537 'labels.', static_labels, id)
541 def host_remove_labels(id, labels):
542 """Removes labels from a given host.
545 @param labels: ids or names for labels.
547 remove_labels_from_host(id, labels)
551 id=id, labels=labels)
630 @param multiple_labels: match hosts in all of the labels given. Should
660 # Only keep static labels which has a corresponding entries in
669 host_dict['labels'] = [label.name for label in label_list]
673 host_dict['labels'] = [label.name for label in host_obj.label_list]
881 dependencies: A list of the names of labels on which the job depends.
1278 other_labels = host_dict['labels']
1291 # convert keys from Label objects to strings (names of labels)
1678 labels: Sorted list of labels not start with 'cros-version' and
1711 result['labels'] = get_labels(
1874 @param child_dependencies: (optional) list of additional dependency labels
1875 (strings) that will be added as dependency labels to child jobs.
2111 serialized['labels'] = [label.name for label in shard.labels.all()]
2116 def _assign_board_to_shard_precheck(labels):
2117 """Verify whether board labels are valid to be added to a given shard.
2123 @param labels: Board labels separated by comma.
2131 if not labels:
2132 # allow creation of label-less shards (labels='' would otherwise fail the
2135 labels = labels.split(',')
2137 for label in labels:
2146 shard = models.Shard.objects.get(labels=label)
2155 def add_shard(hostname, labels):
2159 @param labels: Board labels separated by comma. Jobs of one of the labels
2170 labels = _assign_board_to_shard_precheck(labels)
2172 for label in labels:
2173 shard.labels.add(label)
2177 def add_board_to_shard(hostname, labels):
2181 @param labels: Board labels separated by comma.
2189 labels = _assign_board_to_shard_precheck(labels)
2191 for label in labels:
2192 shard.labels.add(label)
2205 @param labels: Board label.
2213 if label not in shard.labels.all():
2217 shard.labels.remove(label)
2260 shard.labels.clear()