CakeFest 2024: The Official CakePHP Conference

Constantes predefinidas

Estas constantes están definidas por esta extensión y estarán disponibles sólo cuando la extensión haya sido compilada con PHP, o bien sea cargada dinámicamente en ejecución.

Valores de retorno. Comprobar siempre GearmanClient::error() o GearmanWorker() para obtener los errores ya que pueden contener más detalles:

GEARMAN_SUCCESS (integer)
La acción fue realizada con éxito.
GEARMAN_IO_WAIT (integer)
En modo no bloqueante, se lanza un evento que podría bloquear.
GEARMAN_ERRNO (integer)
Error del sistema. Comprobar GearmanClient::errno() o GearmanWorker::errno() para obtener el código de error del sistema que se ha retornado.
GEARMAN_NO_ACTIVE_FDS (integer)
Se ha llamado a GearmanClient::wait() o GearmanWorker() sin una conexión.
GEARMAN_UNEXPECTED_PACKET (integer)
Indica que algo ha ido mal en gearmand. Se aplica sólo a GearmanWorker.
GEARMAN_GETADDRINFO (integer)
Falló la resolución DNS (host no válido, puerto, etc).
GEARMAN_NO_SERVERS (integer)
No se ha llamado a GearmanClient::addServer() antes de enviar trabajos o tareas.
GEARMAN_LOST_CONNECTION (integer)
Se perdió la conexión durante una petición.
GEARMAN_MEMORY_ALLOCATION_FAILURE (integer)
No se pudo reservar memoria (sin memoria).
GEARMAN_SERVER_ERROR (integer)
Algo ha fallado en el servidor Gearman y no ha podido manejar la petición correctamente.
GEARMAN_WORK_DATA (integer)
Código de error de tipo Notice obtenido con GearmanClient::returnCode() cuando se usa GearmanClient::do(). Enviado para actualizar el cliente con datos del trabajo que se está ejecutando. Un trabajador lo usa cuando necesita enviar actualizaciones, enviar resultandos parciales o enviar datos en trabajos de larga duración.
GEARMAN_WORK_WARNING (integer)
Código de error de tipo Notice obtenido con GearmanClient::returnCode() cuando se usa GearmanClient::do(). Actualiza el cliente con un warning. Este comportamiento es como GEARMAN_WORK_DATA pero debe ser tratado como un warning en vez de datos de respuesta.
GEARMAN_WORK_STATUS (integer)
Código de error de tipo Notice obtenido con GearmanClient::returnCode() cuando se usa GearmanClient::do(). Enviado para actualizar el estado de un proceso de larga duración. Usar GearmanClient::doStatus() para obtener el porcentaje de tarea completada.
GEARMAN_WORK_EXCEPTION (integer)
Código de error de tipo Notice obtenido con GearmanClient::returnCode() cuando se usa GearmanClient::do(). Indica que el trabajo ha fallado dando una excepción. with a given exception.
GEARMAN_WORK_FAIL (integer)
Código de error de tipo Notice obtenido con GearmanClient::returnCode() cuando se usa GearmanClient::do(). Indica que el trabajo ha fallado.
GEARMAN_COULD_NOT_CONNECT (integer)
Fallo en la conexión a los servidores.
GEARMAN_INVALID_FUNCTION_NAME (integer)
Intento de registrar el nombre de una función como NULL o uso de funciones de llamadas de retorno sin especificarlas correctamente.
GEARMAN_INVALID_WORKER_FUNCTION (integer)
Intento de registrar una funcionón con un NULL en la función de llamada de retorno.
GEARMAN_NO_REGISTERED_FUNCTIONS (integer)
Cuando un trabajador obtiene un trabajo para una función que no registró.
GEARMAN_NO_JOBS (integer)
Para un trabajador no bloqueante, cuando GearmanWorker::work() no tiene ningún trabajo activo.
GEARMAN_ECHO_DATA_CORRUPTION (integer)
Tras GearmanClient::echo() o GearmanWorker::echo(), los datos retornados no coinciden con los datos enviados.
GEARMAN_NEED_WORKLOAD_FN (integer)
Cuando el cliente optó por enviar la carga de trabajo de una tarea pero no especificó la función de retorno para la carga de trabajo.
GEARMAN_PAUSE (integer)
Para el interfaz de tarea no bloqueante, puede ser retornada por la tarea para "pausar" la llamada y retornar de GearmanClient::runTasks(). Debe llamarse a GearmanClient::runTasks() de nuevo para continuar.
GEARMAN_UNKNOWN_STATE (integer)
Error interno de estado en el cliente/trabajador.
GEARMAN_SEND_BUFFER_TOO_SMALL (integer)
Error interno: intento de enviar más información de la que es posible en un trozo atómico debido a los tamaños (definidos en código) de los buffers.
GEARMAN_TIMEOUT (integer)
Se alcazó el límite te tiempo establecido por el cliente/trabajador.

Opciones de GearmanClient:

GEARMAN_CLIENT_NON_BLOCKING (integer)
Ejecutar el cliente en modo no bloqueante.
GEARMAN_CLIENT_UNBUFFERED_RESULT (integer)
Permite al cliente leer datos en bloques en vez de tener en el buffer el resultado completo y pasarlo.
GEARMAN_CLIENT_FREE_TASKS (integer)
Liberar automáticamente objetos una vez que se han completado. Esta es la opción por defecto en esta extensión para intentar evitar pérdidas de memoria.

Opciones de GearmanWorker:

GEARMAN_WORKER_NON_BLOCKING (integer)
Ejecuta el trabajador en modo no bloqueante.
GEARMAN_WORKER_GRAB_UNIQ (integer)
Retirna el identificador único asignado al cliente además del manejador del trabajo.

Configuración base de Gearman:

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

add a note

User Contributed Notes 5 notes

up
7
ion dot dulgheru at gmail dot com
11 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
13 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
8 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
8 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
1 year 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