Runs a single high priority task and returns a string representation of the result.

@param string $functionName
@param string $workload
@param string $unique

@return string
438023
public function doHigh($functionName, $workload, $unique = null)
    {
        return $this->runSingleTaskSet($this->createSet($functionName, $workload, $unique, Task::JOB_HIGH));
    }
383759
function handleInternalRequest( $functionName, $params, $server=null )
    {
        if ( $server === null )
        {
            $server = $this;
        }
        switch( $functionName )
        {
            case 'system.listMethods':
                if ( count( $params ) != 0 )
                {
                    return new ggWebservicesFault( self::INVALIDPARAMSERROR, self::INVALIDPARAMSSTRING );
                }
                return $server->registeredMethods();

            case 'system.methodSignature':
                if ( count( $params ) != 1 || !is_string( $params[0] ) )
                {
                    return new ggWebservicesFault( self::INVALIDPARAMSERROR, self::INVALIDPARAMSSTRING );
                }
                if ( in_array( $params[0], $server->internalMethods ) )
                {
                    switch( $params[0] )
                    {
                        case 'system.listMethods':
                            return array( array( 'array' ) );
                        case 'system.methodSignature':
                            return array( array( 'array', 'string' ) );
                        case 'system.methodHelp':
                            return array( array( 'string', 'string' ) );
                        case 'system.multicall':
                            return array( array( 'array', 'array' ) );
                    }
                }
                if ( !array_key_exists( $params[0], $server->FunctionList ) )
                {
                    return new ggWebservicesFault( self::INVALIDINTROSPECTIONERROR, self::INVALIDINTROSPECTIONSTRING );
                }
                $results = array();
                foreach( $server->FunctionList[$params[0]] as $syntax )
                {
                    if ( $syntax['in'] !== null )
                    {
                        $syntax['in'] = array_values( $syntax['in'] );
                        array_unshift( $syntax['in'], $syntax['out'] );
                        $results[] = $syntax['in'];
                    }
                }
                return $results;

            case 'system.methodHelp':
                if ( count( $params ) != 1 || !is_string( $params[0] ) )
                {
                    return new ggWebservicesFault( self::INVALIDPARAMSERROR, self::INVALIDPARAMSSTRING );
                }
                if ( in_array( $params[0], $server->internalMethods ) )
                {
                    switch( $params[0] )
                    {
                        case 'system.listMethods':
                            return 'This method lists all the methods that the server knows how to dispatch';
                        case 'system.methodSignature':
                            return 'Returns an array of known signatures (an array of arrays) for the method name passed. First member of each array is the return type';
                        case 'system.methodHelp':
                            return 'Returns help text if defined for the method passed, otherwise returns an empty string';
                        case 'system.multicall':
                            return 'Boxcar multiple RPC calls in one request. See http://www.xmlrpc.com/discuss/msgReader$1208 for details';
                    }
                }
                if ( !array_key_exists( $params[0], $server->FunctionDescription ) )
                {
                    return new ggWebservicesFault( self::INVALIDINTROSPECTIONERROR, self::INVALIDINTROSPECTIONSTRING );
                }
                return $server->FunctionDescription[$params[0]];

            case 'system.multicall':
                // validate first the multicall syntax
                if ( count( $params ) != 1 || !is_array( $params[0] ) )
                {
                    return new ggWebservicesFault( self::INVALIDPARAMSERROR, self::INVALIDPARAMSSTRING );
                }
                foreach( $params[0] as $request )
                {
                    if ( !is_array( $request ) || //count( $request ) != 2 ||
                         !array_key_exists( 'methodName', $request) || !is_string( $request['methodName'] )||
                         !array_key_exists( 'params', $request ) || !is_array( $request['params'] ) )
                    {
                        return new ggWebservicesFault( self::INVALIDPARAMSERROR, self::INVALIDPARAMSSTRING );
                    }
                }
                // then execute all methods
                $results = array();
                foreach( $params[0] as $request)
                {
                    $resp = $server->handleRequest( $request['methodName'], $request['params'] );
                    if ( is_a( $resp, 'ggWebservicesFault' ) )
                    {
                        $results[] = array( 'faultCode' => $resp->faultCode(), 'faultString' => $resp->faultString() );
                    }
                    else
                    {
                        $results[] = $resp;
                    }
                }
                return $results;
            default:
                return parent::handleInternalRequest( $functionName, $params );
        }
    }
220673
def _fire_ret_load_specific_fun(self, load, fun_index=0):
        '''
        
        '''
        if isinstance(load['fun'], list):
            # Multi-function job
            fun = load['fun'][fun_index]
            # 'retcode' was already validated to exist and be non-zero
            # for the given function in the caller.
            if isinstance(load['retcode'], list):
                # Multi-function ordered
                ret = load.get('return')
                if isinstance(ret, list) and len(ret) > fun_index:
                    ret = ret[fun_index]
                else:
                    ret = {}
                retcode = load['retcode'][fun_index]
            else:
                ret = load.get('return', {})
                ret = ret.get(fun, {})
                retcode = load['retcode'][fun]
        else:
            # Single-function job
            fun = load['fun']
            ret = load.get('return', {})
            retcode = load['retcode']

        try:
            for tag, data in six.iteritems(ret):
                data['retcode'] = retcode
                tags = tag.split('_|-')
                if data.get('result') is False:
                    self.fire_event(
                        data,
                        '{0}.{1}'.format(tags[0], tags[-1])
                    )  # old dup event
                    data['jid'] = load['jid']
                    data['id'] = load['id']
                    data['success'] = False
                    data['return'] = 'Error: {0}.{1}'.format(
                        tags[0], tags[-1])
                    data['fun'] = fun
                    data['user'] = load['user']
                    self.fire_event(
                        data,
                        tagify([load['jid'],
                                'sub',
                                load['id'],
                                'error',
                                fun],
                               'job'))
        except Exception:
            pass
624738
protected function setOrderByFunction(String $query, String $functionName) : String
	{
		if ($functionName !== null && $functionName !== '') {
			$query = ' ORDER BY ' . $functionName . '(' . $query . ')';
		}

		return $query;
	}
448154
static function createNew( $moduleName, $functionName, $connectType, $workflowID, $name = false )
    {
        if ( !$name )
        {
            if ( $connectType == 'b' )
            {
                $name = 'pre_';
            }
            else if ( $connectType == 'a' )
            {
                $name = 'post_';
            }
            $name .= $functionName;
        }
        $trigger = new eZTrigger( array( 'module_name' => $moduleName,
                                         'function_name' => $functionName,
                                         'connect_type' => $connectType,
                                         'workflow_id' => $workflowID,
                                         'name' => $name ) );
        $trigger->store();
        return $trigger;
    }
1286183
public function call($functionname, $params) {
        global $DB, $CFG;

         if ($this->format == 'json') {
             $formatparam = '&moodlewsrestformat=json';
             $this->serverurl->param('moodlewsrestformat','json');
         } else {
             $formatparam = ''; //to keep retro compability with old server that only support xml (they don't expect this param)
         }

        $this->serverurl->param('wstoken',$this->token);
        $this->serverurl->param('wsfunction',$functionname); //you could also use params().

        $result = download_file_content($this->serverurl->out(false), null, $params);

        //TODO MDL-22965 transform the XML result into PHP values
        if ($this->format == 'json') {
            $result = json_decode($result);
        }

        return $result;
    }
658366
public static function funcInfo($functionName)
    {
        $result = self::_getFunction($functionName);
        if ($result) {
            $functionName = $result['name'];
        }
        return self::i()->dump($result, '! function (' . $functionName . ') !');
    }
723708
public function uniqueIn(IObjectSet $objects, string $propertyName)
    {
        $this->customProcessorCallbacks[] = function (IType $currentType, IFieldType $fieldType, $initialValue) use ($objects, $propertyName) {
            return new UniquePropertyValidator(
                $currentType,
                $objects,
                $propertyName,
                $initialValue
            );
        };

        return $this;
    }
785806
public function getTaskServiceId($workflow, $taskName)
    {
        if (!isset($this->workflows[$workflow])) {
            $this->loadWorkflow($workflow);
        }

        return $this->workflows[$workflow]->getTask($taskName);
    }
1311021
public function doNormal($functionName, $workload, $unique = null)
    {
        return $this->runSingleTaskSet($this->createSet($functionName, $workload, $unique));
    }
316372
function finish(\Swoole\Server $server, int $taskId, string $data){//仅限worker进程中触发
    echo __METHOD__, $taskId, $data, PHP_EOL;
  }
317173
public function invoke(string $functionName, $event = null): InvocationResult
    {
        $rawResult = $this->lambda->invoke([
            'FunctionName' => $functionName,
            'LogType' => 'Tail',
            'Payload' => $event ?? '',
        ]);

        /** @var StreamInterface $resultPayload */
        $resultPayload = $rawResult->get('Payload');
        $resultPayload = json_decode($resultPayload->getContents(), true);

        $invocationResult = new InvocationResult($rawResult, $resultPayload);

        $error = $rawResult->get('FunctionError');
        if ($error) {
            throw new InvocationFailed($invocationResult);
        }

        return $invocationResult;
    }
770343
private function createSet($functionName, $workload, $unique = null, $type = Task::JOB_NORMAL, $epoch = 0)
    {
        if (null === $unique) {
            $unique = $this->generateUniqueId();
        }

        $task = new Task($functionName, $workload, $unique, $type, $epoch);
        $task->type = $type;
        $set = new Set();
        $set->addTask($task);

        return $set;
    }
919462
function FunctionCall($functionName, array $params = array(), $alias = '', $distinctParams = false)
    {
        return parent::CreateFunctionCall($functionName, $params, $alias, $distinctParams);
    }
602120
public static function task($data, $worker_id = -1, $callback = null) {
		if ($callback === true) {
			return self::$server->taskCo([$data]);
		} elseif (is_callable($callback)) {
			self::$server->task($data, $worker_id, $callback);
		} else {
			self::$server->task($data, $worker_id);
		}
	}
1060772
function invokeTask(taskName)
{
    const tc = TASKS.globals.globalTaskCollection;
    const t = tc.getByName(taskName);
    if (t === undefined)
    {
        YERROR.raiseError(`task ${taskName} not found`);
    }

    TASKS.invokeTask(tc, t);    
}
566717
protected function getActualPriority(string $eventName, $priority): int
    {
        if (\is_int($priority)) {
            return $priority;
        }
        if (!\in_array($priority, ['first', 'last'], \true)) {
            $mess = 'Unknown priority was given only "first", "last", or integer may be used';
            throw new \InvalidArgumentException($mess);
        }
        $listenerM = parent::getActualPriority($eventName, $priority);
        if ($priority === 'first') {
            $serviceM = \array_key_exists($eventName, $this->serviceListeners)
                ? \max(\array_keys($this->serviceListeners[$eventName])) + 1 : 1;
            return ($listenerM > $serviceM) ? $listenerM : $serviceM;
        }
        $serviceM = \array_key_exists($eventName, $this->serviceListeners)
            ? \min(\array_keys($this->serviceListeners[$eventName])) - 1 : -1;
        return ($listenerM < $serviceM) ? $listenerM : $serviceM;
    }