Get a new furious context and add it to the registry. If a batch size is
    specified, use an AutoContext which inserts tasks in batches as they are
    added to the context.
773297
def new(batch_size=None, **options):
    

    if batch_size:
        new_context = AutoContext(batch_size=batch_size, **options)
    else:
        new_context = Context(**options)

    _local.get_local_context().registry.append(new_context)

    return new_context
996587
def add(self, task_cls):
		

		registry_tag = task_cls.__registry_tag__
		if registry_tag not in self.__registry.keys():
			self.__registry[registry_tag] = [task_cls]
		elif self.__multiple_tasks_per_tag__ is True:
			self.__registry[registry_tag].append(task_cls)
		else:
			raise RuntimeError('Multiple tasks with same tag appended')
570454
def on_batch_end(self, train, **kwargs):
        ""
        if train: self.stats.append(self.hooks.stored)
998694
def create_batch(cls, size, **kwargs):
        
        return [cls.create(**kwargs) for _ in range(size)]
647991
def add(self, target, args=None, kwargs=None, **options):
        

        # In superclass, add new task to our list of tasks
        target = super(
            AutoContext, self).add(target, args, kwargs, **options)

        self._auto_insert_check()

        return target
28702
def _create_execution_context(self):
        
        if hasattr(self, '_database_link'):
            # client side partitioning query
            return base_execution_context._MultiCollectionQueryExecutionContext(self._client, self._options, self._database_link, self._query, self._partition_key)
        else:
            # 
            return execution_dispatcher._ProxyQueryExecutionContext(self._client, self._collection_link, self._query, self._options, self._fetch_function)
773313
def create_context(self, message_queue, task_id):
        
        params = (self.remote_folder.name, self.parent.kind, self.parent.remote_id)
        return UploadContext(self.settings, params, message_queue, task_id)
204889
def compile_default_action(self, batch_size: Optional[int] = None) -> Sequence[tf.Tensor]:
        '''
        '''
        with self.graph.as_default():
            with tf.name_scope('default_action'):
                self._initialize_default_action_fluents()
                if batch_size is None:
                    return self.default_action_fluents
                return self._compile_batch_fluents(self.default_action_fluents, batch_size)
923758
def add(self, name, handler, group_by=None, aggregator=None):
        """"""
        assert self.batch is not None, "No active batch, call start() first"

        items = self.batch.setdefault(name, collections.OrderedDict())
        if group_by is None:
            # None is special as it means no grouping. In this case we must store all
            # the different handlers and call them all.
            items.setdefault(group_by, []).append((None, handler))
        elif aggregator is not None:
            agg = items.get(group_by, [(None, None)])[0][0]
            items[group_by] = [(aggregator(agg), handler)]
        else:
            items[group_by] = [(None, handler)]
599533
function createContext(params, onNext) {

    var context = function defaultCall(err) {
        return context.next(err);
    };

    //additional parameters that are in effect beyond the object itself
    context.params = params || {};

    //keep us from calling next after a failure
    context.failed = false;


    /*
        Fail causes a hard stop of the process with the error
    */
    context.fail = function fail(err) {
        if (context.failed) throw new Error("Something caused Context.fail() to execute after the context is already failed.");
        failed = true;
        if (typeof err === "string") err = new Error(err);
        onNext(err);
    }


    /*
        Warn is a non-fatal informational warning error
    */
    context.warn = function warn(err) {
        if (typeof err === "string") err = new Error(err);
        console.log("Warning from mock context", err);
    }


    /*
        Call when you are finished with your step and are passing to the next handler
    */
    context.next = function next(err) {
        if (this.failed) throw new Error("Something caused Context.next() to execute after Context.fail().");
        if (err) return this.fail(err);
        onNext();
    }

    return context;

}
179431
def load_registered_fixtures(context):
    
    # -- SELECT STEP REGISTRY:
    # HINT: Newer behave versions use runner.step_registry
    # to be able to support multiple runners, each with its own step_registry.
    runner = context._runner    # pylint: disable=protected-access
    step_registry = getattr(runner, 'step_registry', None)
    if not step_registry:
        # -- BACKWARD-COMPATIBLE: Use module_step_registry
        step_registry = module_step_registry.registry

    # -- SETUP SCENARIO FIXTURES:
    for step in context.scenario.all_steps:
        match = step_registry.find_match(step)
        if match and hasattr(match.func, 'registered_fixtures'):
            if not context.test.fixtures:
                context.test.fixtures = []
            context.test.fixtures.extend(match.func.registered_fixtures)
831617
private synchronized void addContext(final EvaluatorContext context) {
    this.contextStack.add(context);
    this.contextIds.add(context.getId());
  }
979177
def iter_context_results(context, batch_size=10, task_cache=None):
    """"""

    for futures in iget_batches(context.task_ids, batch_size=batch_size):
        for key, future in futures:
            task = future.get_result()

            if task_cache is not None:
                task_cache[key.id()] = task

            yield key.id(), task
1220026
def get_batch(self):
        
        context = self.context
        parent = api.get_parent(context)
        if context.portal_type == "Batch":
            return context
        elif parent.portal_type == "Batch":
            return parent
        return None
1082520
void put(final AbstractBatchEntry batchEntry) {
    try {
        this.queue.put(batchEntry);
    } catch (InterruptedException e) {
        throw new RuntimeException(e);
    }
    if (this.queue.size() >= this.actions) {
      this.scheduler.submit(new Runnable() {
        @Override
        public void run() {
          write();
        }
      });
    }
  }
1237420
private void setupTaskCacheFileAccess(TaskControllerContext context) {
    String taskId = context.task.getTaskID().toString();
    JobID jobId = JobID.forName(getJobId(context));
    //Change permission for the task across all the disks
    for(String localDir : mapredLocalDirs) {
      File f = new File(localDir);
      File taskCacheDir = new File(f,TaskTracker.getLocalTaskDir(
          jobId.toString(), taskId, context.task.isTaskCleanupTask()));
      if(taskCacheDir.exists()) {
        changeDirectoryPermissions(taskCacheDir.getPath(), 
            FILE_PERMISSIONS, true);
      }          
    }//end of local directory Iteration 
  }
1020310
static final Context context(Element match, int matchIndex, int matchSize) {
        return new DefaultContext(match, matchIndex, matchSize);
    }