Reassign a label from one cluster to another.

        Args:
            `destination_cluster`: id/label of the cluster to move the label to

            `label`: label to be moved from the source cluster
196434
def reassign_label(cls, destination_cluster, label):
        
        conn = Qubole.agent(version=Cluster.api_version)
        data = {
                    "destination_cluster": destination_cluster,
                    "label": label
                }
        return conn.put(cls.rest_entity_path + "/reassign-label", data)
281515
private void assign(HashMap<String, DBIDs> labelMap, String label, DBIDRef id) {
    if(labelMap.containsKey(label)) {
      DBIDs exist = labelMap.get(label);
      if(exist instanceof DBID) {
        ModifiableDBIDs n = DBIDUtil.newHashSet();
        n.add((DBID) exist);
        n.add(id);
        labelMap.put(label, n);
      }
      else {
        assert (exist instanceof HashSetModifiableDBIDs);
        assert (exist.size() > 1);
        ((ModifiableDBIDs) exist).add(id);
      }
    }
    else {
      labelMap.put(label, DBIDUtil.deref(id));
    }
  }
933372
def start(cls, cluster_id_label, api_version=None):
        
        conn = Qubole.agent(version=api_version)
        data = {"state": "start"}
        return conn.put(cls.element_path(cluster_id_label) + "/state", data)
972915
def copy(source, destination):
    
    source = os.path.abspath(source)
    destination = os.path.abspath(destination)
    if source != destination:
        if not os.path.exists(os.path.dirname(destination)):
            os.makedirs(os.path.dirname(destination))
        shutil.copyfile(source, destination)
1232422
def copy_keys(source, destination, keys=None):
    
    if keys is None:
        keys = destination.keys()
    for k in set(source) & set(keys):
        destination[k] = source[k]
    return destination
656985
public void resetDestination(String destName)
    {
        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
            SibTr.entry(tc, "resetDestination", destName);

        try
        {
            DestinationHandler dh = destinationIndex.findByName(
                                                                destName,
                                                                messageProcessor.getMessagingEngineBus(),
                                                                null);

            checkDestinationHandlerExists(
                                          dh != null,
                                          destName,
                                          messageProcessor.getMessagingEngineBus());

            // Only applicable to BaseDestinationHandlers
            if (dh instanceof BaseDestinationHandler)
            {
                BaseDestinationHandler bdh = (BaseDestinationHandler) dh;

                // Need to ensure that this change is persisted - specifically that the
                // BDH "toBeIgnored" flag is persisted
                LocalTransaction siTran = txManager.createLocalTransaction(true);

                // Drive the object's reset method
                bdh.reset();

                // Change our entry in the appropriate index.
                destinationIndex.reset(dh);

                // Persist the change
                bdh.requestUpdate((Transaction) siTran);

                // commit the transaction
                siTran.commit();

                if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
                    SibTr.debug(tc, "Have reset destination " + bdh.getName());
            }
            else
            {
                if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
                    SibTr.debug(tc, "Not a BDH, cannot reset destination " + dh.getName());
            }
        } catch (MessageStoreException e)
        {
            // No FFDC code needed

            SibTr.exception(tc, e);

            //throw e;
        } catch (SIException e)
        {
            // No FFDC code needed

            SibTr.exception(tc, e);

            //handleRollback(siTran);
            //        throw e;
        }

        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
            SibTr.exit(tc, "resetDestination");
    }
1189911
public void mark(Label label) {
        adopt(label);
        if (label.marked) {
            throw new IllegalStateException("already marked");
        }
        label.marked = true;
        if (currentLabel != null) {
            jump(label); // blocks must end with a branch, return or throw
        }
        currentLabel = label;
    }
1013151
public void backupAssignment(Assignment assignment, TopologyAssignEvent event) {
        String topologyId = event.getTopologyId();
        String topologyName = event.getTopologyName();
        try {

            StormClusterState zkClusterState = nimbusData.getStormClusterState();
            // one little problem, get tasks twice when assign one topology
            Map<Integer, String> tasks = Cluster.get_all_task_component(zkClusterState, topologyId, null);

            Map<String, List<Integer>> componentTasks = JStormUtils.reverse_map(tasks);

            for (Entry<String, List<Integer>> entry : componentTasks.entrySet()) {
                List<Integer> keys = entry.getValue();
                Collections.sort(keys);
            }

            AssignmentBak assignmentBak = new AssignmentBak(componentTasks, assignment);
            zkClusterState.backup_assignment(topologyName, assignmentBak);
        } catch (Exception e) {
            LOG.warn("Failed to backup " + topologyId + " assignment " + assignment, e);
        }
    }
315406
def transfer(cls, field_mappings, source, destination_factory):
    """"""
    data = dict()
    for index, field_mapping in enumerate(field_mappings):
      try:
        data[field_mapping.destination_name] = field_mapping.get_value(source)
      except Exception as ex:
        raise Exception(
          "Error with mapping #{0} '{1}'->'{2}': {3}".format(
            index,
            field_mapping.source_name,
            field_mapping.destination_name, ex)) from ex
    return destination_factory(data)
1161741
def replace_labels(self, labels):
        
        url = self._build_url('labels', base_url=self._api)
        json = self._json(self._put(url, data=dumps(labels)), 200)
        return [Label(l, self) for l in json] if json else []
1215528
def label(self, name, value, cluster_ids=None):
        
        if cluster_ids is None:
            cluster_ids = self.cluster_view.selected
        if not hasattr(cluster_ids, '__len__'):
            cluster_ids = [cluster_ids]
        if len(cluster_ids) == 0:
            return
        self.cluster_meta.set(name, cluster_ids, value)
        self._global_history.action(self.cluster_meta)
747615
public void setAssignedLabel(Label l) throws IOException {
        if(l==null) {
            canRoam = true;
            assignedNode = null;
        } else {
            canRoam = false;
            if(l== Jenkins.getInstance().getSelfLabel())  assignedNode = null;
            else                                        assignedNode = l.getExpression();
        }
        save();
    }
984812
function (destination, source) {
            _gpfIgnore(source);
            _gpfArrayTail(arguments).forEach(function (nthSource) {
                _gpfObjectForEach(nthSource, _gpfObjectAssign, destination);
            });
            return destination;
        }
175105
public static Assignments cluster(Matrix matrix,
                                      int numClusters,
                                      int numRepetitions,
                                      CriterionFunction criterion) {
        return cluster(matrix, numClusters, numRepetitions,
                       new RandomSeed(), criterion);
    }
1181730
def remove_label(self, doc, label, update_index=True):
        
        doc = doc.clone()  # make sure it's serializable
        r = self.index.remove_label(doc, label, update_index=update_index)
        return r
993837
def duplicate_node(self, source_node_id, destination_node_id):
        
        source_node = self.get_node(source_node_id)
        destination_node = self.get_node(destination_node_id)

        # Some node don't have working dir like switch
        if not hasattr(destination_node, "working_dir"):
            return destination_node

        destination_dir = destination_node.working_dir
        try:
            shutil.rmtree(destination_dir)
            shutil.copytree(source_node.working_dir, destination_dir)
        except OSError as e:
            raise aiohttp.web.HTTPConflict(text="Can't duplicate node data: {}".format(e))

        # We force a refresh of the name. This force the rewrite
        # of some configuration files
        node_name = destination_node.name
        destination_node.name = node_name + str(uuid4())
        destination_node.name = node_name

        return destination_node
603821
def move_item(self, item, origin, destination):
        
        if self.equality:
            item_index = 0
            for i, element in enumerate(origin):
                if self.equality(element, item):
                    item_index = i
                    break
        else:
            item_index = origin.index(item)

        destination.append(origin.pop(item_index))