Construct and start new Artifact Collection hunt.

    Returns:
      The newly created GRR hunt object.

    Raises:
      RuntimeError: if no items specified for collection.
343297
def process(self):
    

    print('Artifacts to be collected: {0!s}'.format(self.artifacts))
    hunt_args = flows_pb2.ArtifactCollectorFlowArgs(
        artifact_list=self.artifacts,
        use_tsk=self.use_tsk,
        ignore_interpolation_errors=True,
        apply_parsers=False,)
    return self._create_hunt('ArtifactCollectorFlow', hunt_args)
251614
def new(self, items:Iterator, processor:PreProcessors=None, **kwargs)->'ItemList':
        ""
        processor = ifnone(processor, self.processor)
        copy_d = {o:getattr(self,o) for o in self.copy_new}
        kwargs = {**copy_d, **kwargs}
        return self.__class__(items=items, processor=processor, **kwargs)
1243300
def get_new_actions(self):
        
        try:
            _t0 = time.time()
            self.do_get_new_actions()
            statsmgr.timer('actions.got.time', time.time() - _t0)
        except RuntimeError:
            logger.error("Exception like issue #1007")
489964
def new_artifact_content name, options = {}, &block
      type = get_type(options)
      content = extract_content type, options, &block
      %Q{class #{marker(name, type)}
  #{content}
end}
    end
1120513
public CuratorFramework newCurator() {
        // Make all of the curator threads daemon threads so they don't block the JVM from terminating.  Also label them
        // with the ensemble they're connecting to, in case someone is trying to sort through a thread dump.
        ThreadFactory threadFactory = new ThreadFactoryBuilder()
                .setNameFormat("CuratorFramework[" + _connectString.orElse(DEFAULT_CONNECT_STRING) + "]-%d")
                .setDaemon(true)
                .build();

        org.apache.curator.RetryPolicy retry = _setterRetryPolicy.orElse(
                (_configRetryPolicy != null)
                        ? _configRetryPolicy
                        : DEFAULT_RETRY_POLICY
        );
        return CuratorFrameworkFactory.builder()
                .ensembleProvider(new ResolvingEnsembleProvider(_connectString.orElse(DEFAULT_CONNECT_STRING)))
                .retryPolicy(retry)
                .sessionTimeoutMs(Ints.checkedCast(_sessionTimeout.toMilliseconds()))
                .connectionTimeoutMs(Ints.checkedCast(_connectionTimeout.toMilliseconds()))
                .namespace(_namespace.orElse(null))
                .threadFactory(threadFactory)
                .build();
    }
189017
def new(cls, rId, reltype, target, target_mode=RTM.INTERNAL):
        
        xml = '<Relationship xmlns="%s"/>' % nsmap['pr']
        relationship = parse_xml(xml)
        relationship.rId = rId
        relationship.reltype = reltype
        relationship.target_ref = target
        relationship.targetMode = target_mode
        return relationship
630125
async def act(self):
        '''
        '''
        # Learn from domain artifacts.
        self.age += 1
        self.added_last = False
        self.learn_from_domain(method=self.env_learning_method,
                               amount=self.env_learning_amount)
        # Invent new artifact
        artifact = self.invent(self.search_width)
        args = artifact.framings[self.name]['args']
        val = artifact.evals[self.name]
        self._log(logging.DEBUG, "Created spirograph with args={}, val={}"
                  .format(args, val))
        self.spiro_args = args
        self.arg_history.append(self.spiro_args)
        self.add_artifact(artifact)
        if val >= self._own_threshold:
            artifact.self_criticism = 'pass'
            # Train SOM with the invented artifact
            self.learn(artifact, self.teaching_iterations)
            # Save images if logger is defined
            # Add created artifact to voting candidates in the environment
            self.add_candidate(artifact)
            self.added_last = True
        elif self.jump == 'random':
            largs = self.spiro_args
            self.spiro_args = np.random.uniform(-199, 199,
                                                self.spiro_args.shape)
            self._log(logging.DEBUG, "Jumped from {} to {}"
                      .format(largs, self.spiro_args))
        self.save_images(artifact)
109983
def new(
    name,
    bucket,
    timeout,
    memory,
    description,
    subnet_ids,
    security_group_ids
):
    
    config = {}
    if timeout:
        config['timeout'] = timeout
    if memory:
        config['memory'] = memory
    if description:
        config['description'] = description
    if subnet_ids:
        config['subnet_ids'] = subnet_ids
    if security_group_ids:
        config['security_group_ids'] = security_group_ids

    lambder.create_project(name, bucket, config)
533610
def run(self):
        
        self.thr = threading.Thread(target=self.collect_and_report)
        self.thr.daemon = True
        self.thr.name = "Instana Metric Collection"
        self.thr.start()
1299726
def make(collector, image, **kwargs):
    """"""
    tag = kwargs.get("artifact", NotSpecified)
    if tag is NotSpecified:
        tag = collector.configuration["harpoon"].tag

    if tag is not NotSpecified:
        image.tag = tag

    Builder().make_image(image, collector.configuration["images"])
    print("Created image {0}".format(image.image_name))
628822
def virtual_resource(self):
        
        resource = create_collection(
            self.get_relation(
                'virtual_resources',
                UnsupportedEngineFeature),
            VirtualResource)
        resource._load_from_engine(self, 'virtualResources')
        return resource
483825
def CreateApproval(self,
                     reason=None,
                     notified_users=None,
                     email_cc_addresses=None):
    """"""

    if not reason:
      raise ValueError("reason can't be empty")

    if not notified_users:
      raise ValueError("notified_users list can't be empty.")

    approval = user_pb2.ApiHuntApproval(
        reason=reason,
        notified_users=notified_users,
        email_cc_addresses=email_cc_addresses or [])
    args = user_pb2.ApiCreateHuntApprovalArgs(
        hunt_id=self.hunt_id, approval=approval)

    data = self._context.SendRequest("CreateHuntApproval", args)
    return HuntApproval(
        data=data, username=self._context.username, context=self._context)
357996
def new(cls) -> 'Generator':
        
        logger = logging.getLogger(__name__)
        logger.debug("Generator::new: >>>")

        c_instance = c_void_p()
        do_call(cls.new_handler, byref(c_instance))

        res = cls(c_instance)

        logger.debug("Generator::new: <<< res: %r", res)
        return res
439715
def run(self):
        
        logger = getLogger(__name__)

        try:
            task_class_name = self.arguments[0]
        except IndexError:
            raise SphinxError(
                '{} directive requires a Task class '
                'name as an argument'.format(self.directive_name))

        logger.debug(
            '%s running with %r', self.directive_name, task_class_name)

        task_class = get_type(task_class_name)

        new_nodes = []
        new_nodes.extend(self._format_import_example(task_class))
        new_nodes.extend(self._format_summary_node(task_class))
        new_nodes.extend(self._format_api_docs_link_message(task_class))

        return new_nodes
1064741
def new(self, page_name, **dict):
        '''
        
        '''
        self._item_new_path = '/projects/%s/wiki/%s.json' % \
            (self._project.identifier, page_name)
        # Call the base class new method
        return super(Redmine_Wiki_Pages_Manager, self).new(**dict)
1285777
def gather_candidates(self):
        
        async def slave_task(addr):
            r_manager = await self.env.connect(addr)
            return await r_manager.get_candidates()

        if self._single_env:
            self._candidates = self.env.candidates
        else:
            mgrs = self.get_managers()
            tasks = create_tasks(slave_task, mgrs)
            self._candidates = run(tasks)
1309235
def _RunAction(self, rule, client_id):
    
    actions_count = 0

    try:
      if self._CheckIfHuntTaskWasAssigned(client_id, rule.hunt_id):
        logging.info(
            "Foreman: ignoring hunt %s on client %s: was started "
            "here before", client_id, rule.hunt_id)
      else:
        logging.info("Foreman: Starting hunt %s on client %s.", rule.hunt_id,
                     client_id)

        # hunt_name is only used for legacy hunts.
        if rule.hunt_name:
          flow_cls = registry.AFF4FlowRegistry.FlowClassByName(rule.hunt_name)
          hunt_urn = rdfvalue.RDFURN("aff4:/hunts/%s" % rule.hunt_id)
          flow_cls.StartClients(hunt_urn, [client_id])
        else:
          hunt.StartHuntFlowOnClient(client_id, rule.hunt_id)

        actions_count += 1

    # There could be all kinds of errors we don't know about when starting the
    # hunt so we catch everything here.
    except Exception as e:  # pylint: disable=broad-except
      logging.exception("Failure running foreman action on client %s: %s",
                        rule.hunt_id, e)

    return actions_count