Constantes predefinidas

As contantes abaixo são definidas por esta extensão e só estarão disponíveis quando a extensão tiver sido compilada no PHP ou tiver sido carregada dinamicamente em tempo de execução.

Valores de retorno. Sempre verifique GearmanClient::error() ou GearmanWorker() para um erro de string, pois ele pode conter mais detalhes:

GEARMAN_SUCCESS (int)
Qualquer ação tomada foi bem-sucedida.
GEARMAN_IO_WAIT (int)
No modo sem bloqueio, ocorre um evento que teria bloqueado.
GEARMAN_ERRNO (int)
Um erro de sistema. Verifique GearmanClient::errno() ou GearmanWorker::errno() para o código de erro de sistema que foi retornado.
GEARMAN_NO_ACTIVE_FDS (int)
GearmanClient::wait() ou GearmanWorker() foi chamado sem conexões.
GEARMAN_UNEXPECTED_PACKET (int)
Indica que algo está muito errado no gearmand. Aplica-se somente a GearmanWorker.
GEARMAN_GETADDRINFO (int)
Falha na resolução de DNS (host, porta, etc. inválidos).
GEARMAN_NO_SERVERS (int)
Não chamou GearmanClient::addServer() antes de enviar trabalhos ou tarefas.
GEARMAN_LOST_CONNECTION (int)
Perdeu a conexão durante uma solicitação.
GEARMAN_MEMORY_ALLOCATION_FAILURE (int)
Falha na alocação de memória (falta de memória).
GEARMAN_SERVER_ERROR (int)
Algo deu errado no servidor Gearman e ele não conseguiu lidar com a solicitação elegantemente.
GEARMAN_WORK_DATA (int)
Observe o código de retorno obtido com GearmanClient::returnCode() ao usar GearmanClient::do(). Enviado para atualizar o cliente com dados de um trabalho em execução. Um trabalhador usa isso quando precisa enviar atualizações, enviar resultados parciais ou liberar dados durante trabalhos de execução longa.
GEARMAN_WORK_WARNING (int)
Observe o código de retorno obtido com GearmanClient::returnCode() ao usar GearmanClient::do(). Atualiza o cliente com um aviso. O comportamento é como GEARMAN_WORK_DATA, mas deve ser tratado como um aviso em vez de dados de resposta normais.
GEARMAN_WORK_STATUS (int)
Observe o código de retorno obtido com GearmanClient::returnCode() ao usar GearmanClient::do(). Enviado para atualizar o status de um trabalho de longa execução. Use GearmanClient::doStatus() para obter a porcentagem concluída da tarefa.
GEARMAN_WORK_EXCEPTION (int)
Observe o código de retorno obtido com GearmanClient::returnCode() ao usar GearmanClient::do(). Indica que um trabalho falhou com uma exceção fornecida.
GEARMAN_WORK_FAIL (int)
Observe o código de retorno obtido com GearmanClient::returnCode() ao usar GearmanClient::do(). Indica que o trabalho falhou.
GEARMAN_COULD_NOT_CONNECT (int)
Falha ao conectar aos servidores.
GEARMAN_INVALID_FUNCTION_NAME (int)
Tentando registrar um nome de função NULL ou usando a interface de retorno de chamada sem especificar retornos de chamada.
GEARMAN_INVALID_WORKER_FUNCTION (int)
Tentando registrar uma função com uma função de retorno de chamada NULL.
GEARMAN_NO_REGISTERED_FUNCTIONS (int)
Quando um trabalhador consegue uma tarefa para uma função, ele não é registrado.
GEARMAN_NO_JOBS (int)
Para um trabalhador não bloqueador, quando GearmanWorker::work() não tem nenhum trabalho ativo.
GEARMAN_ECHO_DATA_CORRUPTION (int)
Após GearmanClient::echo() ou GearmanWorker::echo() os dados retornados não correspondem aos dados enviados.
GEARMAN_NEED_WORKLOAD_FN (int)
Quando o cliente optou por transmitir a carga de trabalho de uma tarefa, mas não especificou uma função de retorno de chamada de carga de trabalho.
GEARMAN_PAUSE (int)
Para a interface de tarefa do cliente não bloqueante, pode ser retornado do callback da tarefa para "pausar" a chamada e retornar de GearmanClient::runTasks(). Chame GearmanClient::runTasks() novamente para continuar.
GEARMAN_UNKNOWN_STATE (int)
Erro interno de estado do cliente/trabalhador.
GEARMAN_SEND_BUFFER_TOO_SMALL (int)
Erro interno: tentando liberar mais dados em um bloco atômico do que é possível devido a tamanhos de buffer codificados.
GEARMAN_TIMEOUT (int)
Atingiu o limite de tempo definido pelo cliente/trabalhador.

Opções de GearmanClient:

GEARMAN_CLIENT_GENERATE_UNIQUE (int)
Gera um ID exclusivo (UUID) para cada tarefa.
GEARMAN_CLIENT_NON_BLOCKING (int)
Executa o ciente em um modo não bloqueante.
GEARMAN_CLIENT_UNBUFFERED_RESULT (int)
Permite que o cliente leia dados em blocos em vez de ter a biblioteca armazenando em buffer todo o resultado dos dados e passando-o de volta.
GEARMAN_CLIENT_FREE_TASKS (int)
Libera automaticamente objetos de tarefa quando eles são concluídos. Esta é a configuração padrão nesta extensão para evitar vazamentos de memória.

Opções de GearmanWorker:

GEARMAN_WORKER_NON_BLOCKING (int)
Executa o trabalhador em modo não bloqueante.
GEARMAN_WORKER_GRAB_UNIQ (int)
Retorna o ID exclusivo atribuído ao cliente, além do identificador do trabalho.

Configuração básica do Gearman:

GEARMAN_DEFAULT_TCP_HOST (string)
GEARMAN_DEFAULT_TCP_PORT (int)
GEARMAN_DEFAULT_SOCKET_TIMEOUT (int)
GEARMAN_DEFAULT_SOCKET_SEND_SIZE (int)
GEARMAN_DEFAULT_SOCKET_RECV_SIZE (int)
GEARMAN_MAX_ERROR_SIZE (int)
GEARMAN_PACKET_HEADER_SIZE (int)
GEARMAN_JOB_HANDLE_SIZE (int)
GEARMAN_OPTION_SIZE (int)
GEARMAN_UNIQUE_SIZE (int)
GEARMAN_MAX_COMMAND_ARGS (int)
GEARMAN_ARGS_BUFFER_SIZE (int)
GEARMAN_SEND_BUFFER_SIZE (int)
GEARMAN_RECV_BUFFER_SIZE (int)
GEARMAN_WORKER_WAIT_TIMEOUT (int)

adicione uma nota

Notas Enviadas por Usuários (em inglês) 5 notes

up
7
ion dot dulgheru at gmail dot com
12 years ago
an update (gearman 0.35):

GEARMAN_NO_REGISTERED_FUNCTION = 33
GEARMAN_NO_REGISTERED_FUNCTIONS = 34
GEARMAN_NO_JOBS = 35
GEARMAN_ECHO_DATA_CORRUPTION = 36
GEARMAN_NEED_WORKLOAD_FN = 37
GEARMAN_PAUSE = 38
GEARMAN_UNKNOWN_STATE = 39
GEARMAN_PTHREAD = 40
GEARMAN_PIPE_EOF = 41
GEARMAN_QUEUE_ERROR = 42
GEARMAN_FLUSH_DATA = 43
GEARMAN_SEND_BUFFER_TOO_SMALL = 44
GEARMAN_IGNORE_PACKET = 45
GEARMAN_UNKNOWN_OPTION = 46
GEARMAN_TIMEOUT = 47
GEARMAN_ARGUMENT_TOO_LARGE = 48
GEARMAN_MAX_RETURN = 49
up
4
Shane Harter
14 years ago
I looked everywhere for for a dump of the values of each of the gearman constants. I ended up in the gearman source.

You'll find this useful if you ever just echo the return code.

GEARMAN_SUCCESS = 0
GEARMAN_IO_WAIT = 1
GEARMAN_SHUTDOWN = 2
GEARMAN_SHUTDOWN_GRACEFUL = 3
GEARMAN_ERRNO = 4
GEARMAN_EVENT = 5
GEARMAN_TOO_MANY_ARGS = 6
GEARMAN_NO_ACTIVE_FDS = 7
GEARMAN_INVALID_MAGIC = 8
GEARMAN_INVALID_COMMAND = 9
GEARMAN_INVALID_PACKET = 10
GEARMAN_UNEXPECTED_PACKET = 11
GEARMAN_GETADDRINFO = 12
GEARMAN_NO_SERVERS = 13
GEARMAN_LOST_CONNECTION = 14
GEARMAN_MEMORY_ALLOCATION_FAILURE = 15
GEARMAN_JOB_EXISTS = 16
GEARMAN_JOB_QUEUE_FULL = 17
GEARMAN_SERVER_ERROR = 18
GEARMAN_WORK_ERROR = 19
GEARMAN_WORK_DATA = 20
GEARMAN_WORK_WARNING = 21
GEARMAN_WORK_STATUS = 22
GEARMAN_WORK_EXCEPTION = 23
GEARMAN_WORK_FAIL = 24
GEARMAN_NOT_CONNECTED = 25
GEARMAN_COULD_NOT_CONNECT = 26
GEARMAN_SEND_IN_PROGRESS = 27
GEARMAN_RECV_IN_PROGRESS = 28
GEARMAN_NOT_FLUSHING = 29
GEARMAN_DATA_TOO_LARGE = 30
GEARMAN_INVALID_FUNCTION_NAME = 31
GEARMAN_INVALID_WORKER_FUNCTION = 32
GEARMAN_NO_REGISTERED_FUNCTIONS = 33
GEARMAN_NO_JOBS = 34
GEARMAN_ECHO_DATA_CORRUPTION = 35
GEARMAN_NEED_WORKLOAD_FN = 36
GEARMAN_PAUSE = 37
GEARMAN_UNKNOWN_STATE = 38
GEARMAN_PTHREAD = 39
GEARMAN_PIPE_EOF = 40
GEARMAN_QUEUE_ERROR = 41
GEARMAN_FLUSH_DATA = 42
GEARMAN_SEND_BUFFER_TOO_SMALL = 43
GEARMAN_IGNORE_PACKET = 44
GEARMAN_UNKNOWN_OPTION = 45
GEARMAN_MAX_RETURN = 46
up
1
michaelhfranze at gmail dot com
9 years ago
If you are getting

Error 26 GEARMAN_COULD_NOT_CONNECT (integer)

and you are running SELinux then you need to set

setsetbool -P http_can_network_connect = 1
up
1
y_inaura at hm-solution dot jp
9 years ago
retrunCodes is missed from No.33 .
I think , Correct retrunCodes are this.

GEARMAN_SUCCESS = 0
GEARMAN_IO_WAIT = 1
GEARMAN_SHUTDOWN = 2
GEARMAN_SHUTDOWN_GRACEFUL = 3
GEARMAN_ERRNO = 4
GEARMAN_EVENT = 5
GEARMAN_TOO_MANY_ARGS = 6
GEARMAN_NO_ACTIVE_FDS = 7
GEARMAN_INVALID_MAGIC = 8
GEARMAN_INVALID_COMMAND = 9
GEARMAN_INVALID_PACKET = 10
GEARMAN_UNEXPECTED_PACKET = 11
GEARMAN_GETADDRINFO = 12
GEARMAN_NO_SERVERS = 13
GEARMAN_LOST_CONNECTION = 14
GEARMAN_MEMORY_ALLOCATION_FAILURE = 15
GEARMAN_JOB_EXISTS = 16
GEARMAN_JOB_QUEUE_FULL = 17
GEARMAN_SERVER_ERROR = 18
GEARMAN_WORK_ERROR = 19
GEARMAN_WORK_DATA = 20
GEARMAN_WORK_WARNING = 21
GEARMAN_WORK_STATUS = 22
GEARMAN_WORK_EXCEPTION = 23
GEARMAN_WORK_FAIL = 24
GEARMAN_NOT_CONNECTED = 25
GEARMAN_COULD_NOT_CONNECT = 26
GEARMAN_SEND_IN_PROGRESS = 27
GEARMAN_RECV_IN_PROGRESS = 28
GEARMAN_NOT_FLUSHING = 29
GEARMAN_DATA_TOO_LARGE = 30
GEARMAN_INVALID_FUNCTION_NAME = 31
GEARMAN_INVALID_WORKER_FUNCTION = 32
GEARMAN_NO_REGISTERED_FUNCTIONS = 34
GEARMAN_NO_JOBS = 35
GEARMAN_ECHO_DATA_CORRUPTION = 36
GEARMAN_NEED_WORKLOAD_FN = 37
GEARMAN_PAUSE = 38
GEARMAN_UNKNOWN_STATE = 39
GEARMAN_PTHREAD = 40
GEARMAN_PIPE_EOF = 41
GEARMAN_QUEUE_ERROR = 42
GEARMAN_FLUSH_DATA = 43
GEARMAN_SEND_BUFFER_TOO_SMALL = 44
GEARMAN_IGNORE_PACKET = 45
GEARMAN_UNKNOWN_OPTION = 46
GEARMAN_MAX_RETURN = 52
up
0
Anonymous
2 years ago
There is an GEARMAN_WORKER_GRAB_JOB_IN_USE constant that allows you to retry a job that has been exited by same or another worker (exited unsuccessfully width code <> 0)
To Top