Pre-tasks handler.
553527
def _pre_tasks(self):
        
        if self.flushdb:
            management.call_command('flush', verbosity=0, interactive=False)
            logger.info('Flushed database')
317715
def on_success(self, retval, task_id, args, kwargs):
        """"""
        super().on_success(retval, task_id, args, kwargs)
        self._operation_run.on_success()
987098
def on_event_pre(self, e: Event) -> None:
        """"""
        super().on_event_pre(e)
        ct_msg = e.init.get('currentTarget', dict())
        if e.type in ('input', 'change'):
            self._set_attribute('value', ct_msg.get('value'))
            _selected = ct_msg.get('selectedOptions', [])
            self._selected_options.clear()
            for opt in self.options:
                if opt.wdom_id in _selected:
                    self._selected_options.append(opt)
                    opt._set_attribute('selected', True)
                else:
                    opt._remove_attribute('selected')
780574
def on_event_pre(self, e: Event) -> None:
        """"""
        super().on_event_pre(e)
        ct_msg = e.init.get('currentTarget', dict())
        if e.type in ('input', 'change'):
            # Update user inputs
            self._set_text_content(ct_msg.get('value') or '')
1219367
def set_pre_handler(self, handler):
        '''
        '''
        set_flag = False
        for protoc in self._pre_handler_table:
            if isinstance(handler, self._pre_handler_table[protoc]["type"]):
                self._pre_handler_table[protoc]["obj"] = handler
                return RET_OK

        if set_flag is False:
            return RET_ERROR
347830
private void doPreemptionNow() {
    int totalShare = nodeManager.getAllocatedCpuForType(type);
    poolGroupManager.distributeShare(totalShare);
    for (PoolGroupSchedulable poolGroup : poolGroupManager.getPoolGroups()) {
      poolGroup.distributeShare();
    }
    int tasksToPreempt = countTasksShouldPreempt();
    if (tasksToPreempt > 0) {
      LOG.info("Found " + tasksToPreempt + " " + type + " tasks to preempt");
      preemptTasks(tasksToPreempt);
    }
  }
1337349
private function beforeTask(
        string $logid,
        int $spanid,
        string $name,
        string $method,
        string $type,
        string $taskClass
    ) {
        $event = new BeforeTaskEvent(TaskEvent::BEFORE_TASK, $logid, $spanid, $name, $method, $type, $taskClass);
        App::trigger($event);
    }
1217465
private void processPredecessors(ProjectType project)
   {
      for (RelationshipType row : project.getRelationship())
      {

         Task currentTask = m_projectFile.getTaskByUniqueID(mapTaskID(row.getSuccessorActivityObjectId()));
         Task predecessorTask = m_projectFile.getTaskByUniqueID(mapTaskID(row.getPredecessorActivityObjectId()));
         if (currentTask != null && predecessorTask != null)
         {
            RelationType type = RELATION_TYPE_MAP.get(row.getType());
            Duration lag = getDuration(row.getLag());
            Relation relation = currentTask.addPredecessor(predecessorTask, type, lag);
            relation.setUniqueID(row.getObjectId());
            m_eventManager.fireRelationReadEvent(relation);
         }
      }
   }
488323
def before(self, context):
        ""
        run.before_each.execute(context)
        self._invoke(self._before, context)
906430
function prepareTasks (allTasks, support) {
    const tasks = {before: {}, after: {}};
    let i;

    for (i = allTasks.length - 1; i >= 0; i--) {
        const task = allTasks[i];

        //browser compatibility
        if (!needFix(support, task, 'forBrowsersLowerThan')) {
            continue;
        }

        if (!needFix(support, task, 'forBrowsersUpperOrEqualTo')) {
            continue;
        }

        //Get type and name
        let types, names;

        if (typeof task.filter === 'string') {
            types = [task.filter];
            names = ['_'];
        } else {
            types = (task.filter.type instanceof Array ? task.filter.type : (task.filter.type ? [task.filter.type] : ['_']));
            names = (task.filter.name instanceof Array ? task.filter.name : (task.filter.name ? [task.filter.name] : ['_']));
        }

        types.forEach(function (type) {
            if (!tasks[task.position].hasOwnProperty(type)) {
                tasks[task.position][type] = {};
            }

            names.forEach(function (name) {
                if (!tasks[task.position][type].hasOwnProperty(name)) {
                    tasks[task.position][type][name] = [];
                }

                tasks[task.position][type][name].push(task);
            });
        });
    }

    return tasks;
}
107950
public function onBeforeWrite()
    {
        if (!$this->Sort) {
            $this->Sort = DB::query('SELECT MAX("Sort") + 1 FROM "WorkflowTransition"')->value();
        }

        parent::onBeforeWrite();
    }
162755
def task(name, deps = None, fn = None):
	""""""
	if callable(deps):
		fn = deps
		deps = None

	if not deps and not fn:
		logger.log(logger.red("The task '%s' is empty" % name))
	else:
		tasks[name] = [fn, deps]
787305
public void prePersist() {
        this.createdAt = getCurrentTime();

        if (this.createdBy == null || this.createdBy.trim().length()<1) {
            this.createdBy = getUserName();
        }
    }
571682
private function startup()
    {
        $this->registerSigHandlers();
        $this->pruneDeadWorkers();
        Event::trigger('beforeFirstFork', $this);
        $this->registerWorker();
    }
1168944
def pre_handler(self, cmd):
        """"""
        if self._finished:
            return
        if self.interesting_commit and cmd.name == 'commit':
            if cmd.mark == self.interesting_commit:
                print(cmd.to_string())
                self._finished = True
            return
        if cmd.name in self.parsed_params:
            fields = self.parsed_params[cmd.name]
            str = cmd.dump_str(fields, self.parsed_params, self.verbose)
            print("%s" % (str,))
441952
async def handler(event):
    """"""
    query = urllib.parse.quote(event.pattern_match.group(1))
    await asyncio.wait([
        event.delete(),
        event.respond(SEARCH.format(query), reply_to=event.reply_to_msg_id)
    ])
683383
def task_done(self):
        """"""
        with self._lock:
            unfinished = self._unfinished_tasks - 1
            if unfinished < 0:
                raise RuntimeError('task_done() called too many times')
            elif unfinished == 0:
                self._alldone.notify()
            self._unfinished_tasks = unfinished