Complete worker.
976389
def worker_complete():
    '''  '''
    if not 'uniqueId' in request.args:
        resp = {"status": "bad request"}
        return jsonify(**resp)
    else:
        unique_id = request.args['uniqueId']
        app.logger.info("Completed experiment %s" % unique_id)
        try:
            user = Participant.query.\
                filter(Participant.uniqueid == unique_id).one()
            user.status = COMPLETED
            user.endhit = datetime.datetime.now()
            db_session.add(user)
            db_session.commit()
            status = "success"
        except exc.SQLAlchemyError:
            status = "database error"
        resp = {"status" : status}
        return jsonify(**resp)
876944
public function doneWorking()
    {
        $this->currentJob = null;
        $this->resque->getStatistic('processed')->incr();
        $this->getStatistic('processed')->incr();
        $this->resque->getClient()->del($this->getJobKey());
    }
928982
def worker(data):
    """"""
    creator = get_creator_by_name(data['creator'])
    shell = creator(data['entry'],
                    ShellConfig(script=data['entry']['script'],
                                title=data['entry']['title'] if 'title' in data['entry'] else '',
                                model=data['model'], env=data['env'], item=data['item'],
                                dry_run=data['dry_run'], debug=data['debug'], strict=data['strict'],
                                variables=data['variables'],
                                temporary_scripts_path=data['temporary_scripts_path']))
    output = []
    for line in shell.process():
        output.append(line)
        Logger.get_logger(__name__ + '.worker').info(" | %s", line)
    return {'id': data['id'], 'success': shell.success, 'output': output}
1179369
def worker_complete():
    """"""
    participant_id = request.args.get("participant_id")
    if not participant_id:
        return error_response(
            error_type="bad request", error_text="participantId parameter is required"
        )

    try:
        _worker_complete(participant_id)
    except KeyError:
        return error_response(
            error_type="ParticipantId not found: {}".format(participant_id)
        )

    return success_response(status="success")
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;
    }
889610
protected function work(): void
    {
        if (@$this->worker->work()
            || $this->worker->returnCode() == GEARMAN_IO_WAIT
            || $this->worker->returnCode() == GEARMAN_NO_JOBS
        ) {
            if ($this->worker->returnCode() == GEARMAN_SUCCESS) {
                return;
            }

            if (!@$this->worker->wait()) {
                if ($this->worker->returnCode() == GEARMAN_NO_ACTIVE_FDS) {
                    sleep(5);
                }
            }
        }
    }
1165372
def _Complete(self):
    """"""
    self._RemoveForemanRule()
    if "w" in self.hunt_obj.mode:
      self.hunt_obj.Set(self.hunt_obj.Schema.STATE("COMPLETED"))
      self.hunt_obj.Flush()
687009
def is_complete(self):
        """"""

        if 'status' in self.transfer_info:
            self._complete = self.transfer_info['status'] == 'STATUS_COMPLETE'

        return self._complete
540381
public function complete()
    {
        $placeholders    = $this->getPlaceholderArray();
        $templatesFolder = $this->getConfigKey('Folders', 'templates');
        $finder          = new Finder();
        foreach ($finder->files()->in($templatesFolder) as $file) {
            $template = file_get_contents($file);
            $mustache = new Mustache_Engine();
            $result   = $mustache->render($template, $placeholders);
            file_put_contents($file, $result);
        }
    }
164747
def complete(self):
        
        return self._post_request(
            data='',
            endpoint=self.ENDPOINT + '/' + str(self.id) + '/complete'
        )
894291
def complete(self):
        """"""
        response = self.api_client._post(self.resource_path, 'complete')
        return self.api_client._make_api_object(response, APIObject)
875322
def work
      success, val, reason = SafeTaskExecutor.new(@task).execute(*@args)
      complete(success, val, reason)
    end
143153
def complete(self, text, state):
        """"""
        if state == 0:
            local._pdbpp_completing = True
            mydict = self.curframe.f_globals.copy()
            mydict.update(self.curframe_locals)
            completer = Completer(mydict)
            self._completions = self._get_all_completions(
                completer.complete, text)

            real_pdb = super(Pdb, self)
            for x in self._get_all_completions(real_pdb.complete, text):
                if x not in self._completions:
                    self._completions.append(x)

            self._filter_completions(text)

            del local._pdbpp_completing

            # Remove "\t" from fancycompleter if there are pdb completions.
            if len(self._completions) > 1 and self._completions[0] == "\t":
                self._completions.pop(0)

        try:
            return self._completions[state]
        except IndexError:
            return None
1132200
def finished(self):
    

    return self.__state in (Job.ERROR, Job.SUCCESS, Job.CANCELLED)
349139
public void complete()
    {
        completeTree();

        StageManager.getStage(Stage.ANTI_ENTROPY).execute(this);

        if (logger.isDebugEnabled())
        {
            // log distribution of rows in tree
            logger.debug("Validated {} partitions for {}.  Partitions per leaf are:", validated, desc.sessionId);
            tree.histogramOfRowCountPerLeaf().log(logger);
            logger.debug("Validated {} partitions for {}.  Partition sizes are:", validated, desc.sessionId);
            tree.histogramOfRowSizePerLeaf().log(logger);
        }
    }
305404
public function complete()
        {
            $chain = $this->chain;
            $this->chaining = false;
            $this->chain = null;
            return $chain;
        }
1209143
public function complete()
    {
        $filesystem      = new Filesystem();
        $templatesFolder = $this->getConfigKey('Folders', 'templates');
        $finder          = new Finder();
        foreach ($finder->files()->in($templatesFolder) as $file) {
            $from = $file->getPathname();
            $to   = $this->getTargetPath($from);
            $filesystem->ensureDirectoryExists(dirname($to));
            $filesystem->copyThenRemove($from, $to);
        }
    }