Does the actual work.
978910
public function _touch()
    {
        if ($this->file !== null) {
            if (!$this->file->exists()) {
                $this->log(
                    "Creating " . $this->file->__toString(),
                    $this->verbose ? Project::MSG_INFO : Project::MSG_VERBOSE
                );
                try { // try to create file
                    $this->file->createNewFile($this->mkdirs);
                } catch (IOException  $ioe) {
                    throw new BuildException(
                        "Error creating new file " . $this->file->__toString(),
                        $ioe,
                        $this->getLocation()
                    );
                }
            }
        }

        $resetMillis = false;
        if ($this->millis < 0) {
            $resetMillis = true;
            $this->millis = Phing::currentTimeMillis();
        }

        if ($this->file !== null) {
            $this->touchFile($this->file);
        }

        // deal with the filesets
        foreach ($this->filesets as $fs) {
            $ds = $fs->getDirectoryScanner($this->getProject());
            $fromDir = $fs->getDir($this->getProject());

            $srcFiles = $ds->getIncludedFiles();
            $srcDirs = $ds->getIncludedDirectories();

            for ($j = 0, $_j = count($srcFiles); $j < $_j; $j++) {
                $this->touchFile(new PhingFile($fromDir, (string) $srcFiles[$j]));
            }

            for ($j = 0, $_j = count($srcDirs); $j < $_j; $j++) {
                $this->touchFile(new PhingFile($fromDir, (string) $srcDirs[$j]));
            }
        }

        // deal with the filelists
        foreach ($this->filelists as $fl) {
            $fromDir = $fl->getDir($this->getProject());

            $srcFiles = $fl->getFiles($this->getProject());

            for ($j = 0, $_j = count($srcFiles); $j < $_j; $j++) {
                $this->touchFile(new PhingFile($fromDir, (string) $srcFiles[$j]));
            }
        }

        if ($resetMillis) {
            $this->millis = -1;
        }
    }
479289
public function doneWorking()
    {
        Event::fire(Event::WORKER_DONE_WORKING, array($this, $this->job));

        $this->redis->hmset(self::redisKey($this), array(
            'job_id'      => '',
            'job_pid'     => 0,
            'job_started' => 0
        ));

        switch ($this->job->getStatus()) {
            case Job::STATUS_COMPLETE:
                $this->redis->hincrby(self::redisKey($this), 'processed', 1);
                break;
            case Job::STATUS_CANCELLED:
                $this->redis->hincrby(self::redisKey($this), 'cancelled', 1);
                break;
            case Job::STATUS_FAILED:
                $this->redis->hincrby(self::redisKey($this), 'failed', 1);
                break;
        }

        $this->job = null;
    }
452014
public function perform()
    {
        $fields = $this->requireOption('fields');

        foreach ($fields as $field => $options) {
            $this->handleFile($field, $options);
        }
    }
658035
@Override
    public boolean isDone() {
        boolean retVal = false;

        if ((m_isDone == true) || (m_pendingException != null)) {
            retVal = true;
        }

        // If we got as far as submitted the work to the default Executor, then ask it.
        if ((m_defaultFuture != null) &&
            m_defaultFuture.isDone()) {
            this.m_isDone = true;
            retVal = true;
        }

        return retVal;
    }
647645
public function doProcess()
    {
        $title = $this->getTitleString();

        $this->auraTitle->set($title);

        if ($this->includeMeta) {
            $this->auraMeta->add($this->getMetaArray($title));
        }
        if ($this->includeSiteName) {
            $this->auraMeta->add($this->getSiteNameArray());
        }

        return true;
    }
227911
@Override
    protected void doPerform() {
        org.openqa.selenium.Keys seleniumKeys = org.openqa.selenium.Keys.getKeyFromUnicode(keys.getKeyCode());
        if (isSourceDocumentRoot()) {
            keyboard().pressKey(seleniumKeys);
        } else {
            getActions().keyDown(getFirstElement(), seleniumKeys).perform();
        }
    }
619721
def set_work(self, work):
        """"""
        if not hasattr(self, "_work"):
            self._work = work
        else:
            if self._work != work:
                raise ValueError("self._work != work")
398904
public function perform()
    {
        $file = $this->requireOption('file');
        $content = $this->getContent();

        if ($this->write($file, $content) === false) {
            $this->fail(I18n::translate('uniform-log-error'));
        }
    }
532614
public function execute(): bool
    {
        $messages = $this->app->make('orchestra.messages');
        $queues = $this->queued();
        $fails = [];

        foreach ($queues as $queue) {
            try {
                $this->driver()->upload($queue);

                $messages->add('success', trans('orchestra/foundation::response.extensions.activate', [
                    'name' => $queue,
                ]));
            } catch (Exception $e) {
                // this could be anything.
                $messages->add('error', $e->getMessage());
                $fails[] = $queue;
            }
        }

        $this->memory->put('orchestra.publisher.queue', $fails);

        return true;
    }
1304470
public function execute() {
        global $CFG;

        require_once($CFG->dirroot . '/mod/assign/locallib.php');
        \assign::cron();

        $plugins = \core_component::get_plugin_list('assignsubmission');

        foreach ($plugins as $name => $plugin) {
            $disabled = get_config('assignsubmission_' . $name, 'disabled');
            if (!$disabled) {
                $class = 'assign_submission_' . $name;
                require_once($CFG->dirroot . '/mod/assign/submission/' . $name . '/locallib.php');
                $class::cron();
            }
        }
        $plugins = \core_component::get_plugin_list('assignfeedback');

        foreach ($plugins as $name => $plugin) {
            $disabled = get_config('assignfeedback_' . $name, 'disabled');
            if (!$disabled) {
                $class = 'assign_feedback_' . $name;
                require_once($CFG->dirroot . '/mod/assign/feedback/' . $name . '/locallib.php');
                $class::cron();
            }
        }

        return true;
    }
672452
def _work(self):
        """"""
        super(HyperVNeutronAgent, self)._work()
        if self._nvgre_enabled:
            self._nvgre_ops.refresh_nvgre_records()
        self._port_enable_control_metrics()
400388
def work():
    """"""
    global n

    cmd = utils.get_project_configuration()
    if 'worker_api_key' not in cmd:
        return ("You need to define a 'worker_api_key' in your ~/")

    chunk_size = 1000

    logging.info("Start working with n=%i", n)
    for _ in range(chunk_size):
        # contact the write-math server and get something to classify
        url = "http://www.martin-thoma.de/write-math/api/get_unclassified.php"
        response = urlopen(url)
        page_source = response.read()
        parsed_json = json.loads(page_source)
        if parsed_json is False:
            return "Nothing left to classify"
        raw_data_json = parsed_json['recording']

        # Classify
        # Check recording
        try:
            json.loads(raw_data_json)
        except ValueError:
            return ("Raw Data ID %s; Invalid JSON string: %s" %
                    (parsed_json['id'], raw_data_json))

        # Classify
        if use_segmenter_flag:
            strokelist = json.loads(raw_data_json)
            beam = se.Beam()
            for stroke in strokelist:
                beam.add_stroke(stroke)
            results = beam.get_writemath_results()
        else:
            results_sym = classify.classify_segmented_recording(raw_data_json)
            results = []
            strokelist = json.loads(raw_data_json)
            segmentation = [list(range(len(strokelist)))]
            translate = _get_translate()
            for symbol in results_sym:
                s = {'id': get_writemath_id(symbol, translate),
                     'probability': symbol['probability']}
                results.append({'probability': symbol['probability'],
                                'segmentation': segmentation,
                                'symbols': [s]})

        print("\thttp://write-math.com/view/?raw_data_id=%s" %
              str(parsed_json['id']))

        # Submit classification to write-math.com server
        results_json = get_json_result(results, n=n)
        headers = {'User-Agent': 'Mozilla/5.0',
                   'Content-Type': 'application/x-www-form-urlencoded'}
        payload = {'recording_id': parsed_json['id'],
                   'results': results_json,
                   'api_key': cmd['worker_api_key']}

        s = requests.Session()
        req = requests.Request('POST', url, headers=headers, data=payload)
        prepared = req.prepare()
        response = s.send(prepared)
        try:
            response = json.loads(response.text)
        except ValueError:
            return "Invalid JSON response: %s" % response.text

        if 'error' in response:
            logging.info(response)
            return str(response)
    return "Done - Classified %i recordings" % chunk_size
121409
protected function perform()
    {
        if ($this->isQuietModeDisabled()) {
            $this->fixer->disableQuietMode();
        }

        $spl = new SplFileInfo($this->file->path());

        return (bool) $this->fixer->fixFile($spl);
    }
345500
protected function doProcess()
    {
        $links = $this->links;
        $meta = $this->meta;

        if ($this->value) {
            $links->add(
                [
                    'rel'  => 'image_src',
                    'href' => $this->value
                ]
            );
            $meta->add(
                [
                    'name' => 'image',
                    'property' => 'og:image',
                    'content' => $this->value
                ]
            );
        }

        return true;
    }
809041
def successful(self):
        """"""
        for result in self.results:
            if result.code == ResultCode.FAILED:
                return False
        return True
1035242
@Override
    protected void doPerform() {
        if (isSourceDocumentRoot()) {
            getActions().contextClick().perform();
        } else {
            getActions().contextClick(getFirstElement()).perform();
        }
    }
898464
def assert_perform_under(threshold, options = {}, &work)
      actual, _ = ExecutionTime.run(options, &work)
      actual <= threshold
    end