Helper for tasks that scan for default target roots.

    :param string goal_name: The goal name to use for any warning emissions.
965433
def determine_target_roots(self, goal_name):
    
    if not self.context.target_roots:
      print('WARNING: No targets were matched in goal `{}`.'.format(goal_name), file=sys.stderr)

    # For the v2 path, e.g. `./pants list` is a functional no-op. This matches the v2 mode behavior
    # of e.g. `./pants --changed-parent=HEAD list` (w/ no changes) returning an empty result.
    return self.context.target_roots
1259784
def get_longest_target_alignment_coords_by_name(self,name):
    
    longest = -1
    coord = None
    #for x in self._queries[self._name_to_num[name]]:
    for line in [self._lines[x] for x in self._name_to_num[name]]:
      if line['flag'] & 2304 == 0: 
        return [line['filestart'],line['innerstart']]
    return None
    sys.stderr.write("ERROR: no primary alignment set in index\n")
    sys.exit()
1298275
def load_by_name name
      path = self.locate_definition name
      raise TargetLoadError.new("Target definition file does not exist for #{name}") if path.nil?
      config = YAML::load_file(path)
      raise TargetLoadError.new("Target definition file #{path} is not valid YAML") if config.nil?
      config = config.deep_symbolize
      self.store_config config
      self.check_constructor name
      self.load_constructor
    end
1289809
def _complete_task(self, task_name, **kwargs):
        

        logger.debug('Job {0} marking task {1} as completed'.format(self.name, task_name))
        self.run_log['tasks'][task_name] = kwargs

        for node in self.downstream(task_name, self.snapshot):
            self._start_if_ready(node)

        try:
            self.backend.acquire_lock()
            self._commit_run_log()
        except:
            logger.exception("Error in handling events.")
        finally:
            self.backend.release_lock()

        if kwargs.get('success', None) == False:
            task = self.tasks[task_name]
            try:
                self.backend.acquire_lock()
                if self.event_handler:
                    self.event_handler.emit('task_failed',
                                            task._serialize(include_run_logs=True))
            except:
                logger.exception("Error in handling events.")
            finally:
                self.backend.release_lock()

        self._on_completion()
1055402
def default_targets(self):
        """"""
        from dvc.stage import Stage

        msg = "assuming default target '{}'.".format(Stage.STAGE_FILE)
        logger.warning(msg)
        return [Stage.STAGE_FILE]
922324
def goal_update(self, goal_id, data, **kwargs):
        ""
        api_path = "/api/v2/goals/{goal_id}"
        api_path = api_path.format(goal_id=goal_id)
        return self.call(api_path, method="PUT", data=data, **kwargs)
957919
def targets(*names, &block)
      if names.empty?
        UI.warning('Book#targets to get all targets is deprecated, use #all_targets instead', location: caller_locations.first)
        return all_targets
      end

      names.map { |name| target(name, &block) }
    end
629683
def verifyTargets(self):
        
        for layer in self.layers:
            if layer.verify and layer.type == 'Output' and layer.active and not layer.targetSet:
                raise LayerError('Targets are not set and verifyTargets() was called.',\
                                   (layer.name, layer.type))
            else:
                layer.resetTargetFlag()
675687
function getTask(name) {
  if (!this.tasks[name]) {
    log.error(new Error('Task "' + name + '" is not registered.'));
    return null;
  }
  return this.tasks[name];
}
565148
def define_per_project_config_builder_tasks
      
      projects.each do |project|
        project.targets.each do |target|
          target.configs.each do |config|
            
            builder_actions.each do |action|
              
              description = "#{action.capitalize} #{project.name} #{target.name} #{config.name}"
              task_name = friendlyname("#{name}:#{project.name}:#{target.name}:#{config.name}:#{action}")
            
              define_task_with description, task_name do
                config.builder.send(action)
              end
              
            end
            
          end
        end
      end
      
      
    end
1365330
def x_build_targets_target( self, node ):
        '''
        
        '''
        target_node = node
        name = self.get_child_data(target_node,tag='name',strip=True)
        path = self.get_child_data(target_node,tag='path',strip=True)
        jam_target = self.get_child_data(target_node,tag='jam-target',strip=True)
        #~ Map for jam targets to virtual targets.
        self.target[jam_target] = {
            'name' : name,
            'path' : path
            }
        #~ Create the ancestry.
        dep_node = self.get_child(self.get_child(target_node,tag='dependencies'),tag='dependency')
        while dep_node:
            child = self.get_data(dep_node,strip=True)
            child_jam_target = '<p%s>%s' % (path,child.split('//',1)[1])
            self.parent[child_jam_target] = jam_target
            dep_node = self.get_sibling(dep_node.nextSibling,tag='dependency')
        return None
1236819
def get_task(self, name):
        """"""
        if name in self.tasks.keys():
            task = self.tasks[name]
        else:
            task = Task(name)
            self.tasks[name] = task
        return task
861326
def start_building (self, main_target_instance):
        
        assert isinstance(main_target_instance, MainTarget)
        if id(main_target_instance) in self.targets_being_built_:
            names = []
            for t in self.targets_being_built_.values() + [main_target_instance]:
                names.append (t.full_name())

            get_manager().errors()("Recursion in main target references\n")

        self.targets_being_built_[id(main_target_instance)] = main_target_instance
592126
function nameTasks(tasks) { //name tasks that are not already named, validation done elsewhere, ret map
    var namesMap = tasks.reduce(function (map, t) {
      if (t.name) { map[t.name] = t; }
      return map;
    }, {});
    tasks.forEach(function (t, idx) {
      if (!t.name) { //not already named
        var name = fName(t.f);
        if (!name) name = sprintf(DEFAULT_TASK_NAME, idx);
        if (!name || namesMap[name]) {
          name = sprintf('%s_%s', name, idx); //if empty or already used, postfix with _idx
        }
        t.name = name;
        namesMap[name] = t;
      }
    });
    return namesMap;
  }
351578
def handle_new_task(self, task_name, record):
        
        record.msg = ColorFormatter.colored('default', START_TASK_MSG)
        record.task = task_name

        self.tasks[task_name] = Task(name=task_name, maxlen=self.buffer_size)
        if self.should_show_by_depth():
            self.pretty_emit(record, is_header=True)
238386
private String get_target_name (String ttype_tname)
  {
    String[] split;
    try {
      split = ttype_tname.split(LOGGING_SEPARATOR);
    } catch (Exception e) {
      return _DefaultTargetName;
    }
    return (split.length > 1) ? split[1] :  _DefaultTargetName;
  }
55875
def goal_show(self, goal_id, **kwargs):
        ""
        api_path = "/api/v2/goals/{goal_id}"
        api_path = api_path.format(goal_id=goal_id)
        return self.call(api_path, **kwargs)