Constantes pré-définies

Ces constantes sont définies par cette extension, et ne sont disponibles que si cette extension a été compilée avec PHP, ou bien chargée au moment de l'exécution.

Valeurs de retour. Cherchez toujours une chaîne de caractères d'erreur dans GearmanClient::error() ou GearmanWorker() car davantage de détails peuvent être disponibles :

GEARMAN_SUCCESS (int)

Quelle que soit l'action entreprise, elle a été couronnée de succès.

GEARMAN_IO_WAIT (int)

En mode non-bloquant, un événement qui aurait été bloquant a été atteint.

GEARMAN_ERRNO (int)

Une erreur système. Cherchez dans GearmanClient::errno() ou GearmanWorker::errno() le code d'erreur système qui a été retourné.

GEARMAN_NO_ACTIVE_FDS (int)

GearmanClient::wait() ou GearmanWorker() a été appelé sans connexion.

GEARMAN_UNEXPECTED_PACKET (int)

Indique que quelque chose de grave est survenu dans gearmand. S'applique seulement à GearmanWorker.

GEARMAN_GETADDRINFO (int)

La résolution DNS a échoué (hôte ou port invalide, etc).

GEARMAN_NO_SERVERS (int)

Aucun appel à GearmanClient::addServer() n'a été fait avant de soumettre une tâche.

GEARMAN_LOST_CONNECTION (int)

Perte de connexion pendant une requête.

GEARMAN_MEMORY_ALLOCATION_FAILURE (int)

L'allocation mémoire a échoué (plus de mémoire disponible).

GEARMAN_SERVER_ERROR (int)

Quelque chose s'est mal passé avec le serveur Gearman qui n'a pas pu traiter la requête comme il se doit.

GEARMAN_WORK_DATA (int)

Un code d'erreur de notification obtenu avec GearmanClient::returnCode() lors de l'utilisation de GearmanClient::do(). Envoyé pour mettre à jour le client avec les données de la tâche courante. Un agent l'utilise quand il a besoin d'envoyer des mises à jour, d'envoyer des résultats partiels ou pour évacuer les données lors de tâches longues.

GEARMAN_WORK_WARNING (int)

Un code d'erreur de notification obtenu avec GearmanClient::returnCode() lors de l'utilisation de GearmanClient::do(). Met à jour le client avec un avertissement. Le comportement est le même qu'avec GEARMAN_WORK_DATA, sauf qu'il devrait être traité comme un avertissement plutôt que comme les données d'une réponse normale.

GEARMAN_WORK_STATUS (int)

Un code d'erreur de notification obtenu avec GearmanClient::returnCode() lors de l'utilisation de GearmanClient::do(). Envoyé pour mettre à jour le statut d'une tâche longue. Utiliser GearmanClient::doStatus() pour obtenir le pourcentage de complétion de la tâche.

GEARMAN_WORK_EXCEPTION (int)

Un code d'erreur de notification obtenu avec GearmanClient::returnCode() lors de l'utilisation de GearmanClient::do(). Indique qu'une tâche a échoué en levant une exception donnée.

GEARMAN_WORK_FAIL (int)

Un code d'erreur de notification obtenu avec GearmanClient::returnCode() lors de l'utilisation de GearmanClient::do(). Indique qu'une tâche a échoué.

GEARMAN_COULD_NOT_CONNECT (int)

Échec de la connexion aux serveurs.

GEARMAN_INVALID_FUNCTION_NAME (int)

Tentative de référencement d'une fonction avec un nom NULL ou utilisation de l'interface de rappel sans spécifier les rappels.

GEARMAN_INVALID_WORKER_FUNCTION (int)

Tentative de référencement d'une fonction avec une fonction de rappel NULL.

GEARMAN_NO_REGISTERED_FUNCTIONS (int)

Quand un agent reçoit une tâche pour une fonction qu'il n'a pas référencée.

GEARMAN_NO_JOBS (int)

Pour un agent non-bloquant, quand GearmanWorker::work() n'a aucune tâche active.

GEARMAN_ECHO_DATA_CORRUPTION (int)

Après GearmanClient::echo() ou GearmanWorker::echo(), les données retournées ne correspondent pas aux données envoyées.

GEARMAN_NEED_WORKLOAD_FN (int)

Quand le client a fait le choix de diffuser la charge de travail sur une tâche, mais n'a pas spécifié de fonction de retour de la charge de travail.

GEARMAN_PAUSE (int)

Pour l'interface de tâche cliente non-bloquante, peut être retourné à partir du retour de la tâche pour "mettre en pause" l'appel et le retour de GearmanClient::runTasks(). Appelez de nouveau GearmanClient::runTasks() pour continuer.

GEARMAN_UNKNOWN_STATE (int)

Erreur d'état client/agent interne.

GEARMAN_SEND_BUFFER_TOO_SMALL (int)

Erreur interne : a essayé d'évacuer davantage de données que possible dans un paquet atomique, à cause de tailles de tampons codées en dur.

GEARMAN_TIMEOUT (int)

La limite de temps de l'agent/du client a été atteinte.

Les options GearmanClient :

GEARMAN_CLIENT_GENERATE_UNIQUE (int)

Génère un identifiant unique (UUID) pour chaque tâche.

GEARMAN_CLIENT_NON_BLOCKING (int)

Lance le client en mode non-bloquant.

GEARMAN_CLIENT_UNBUFFERED_RESULT (int)

Permet au client de lire les données par paquets plutôt que ce soit la bibliothèque qui mette en tampon les données et les transmette.

GEARMAN_CLIENT_FREE_TASKS (int)

Libère automatiquement les objets des tâches une fois celles-ci effectuées. C'est le paramétrage par défaut de cette extension pour éviter les fuites de mémoire.

Les options GearmanWorker :

GEARMAN_WORKER_NON_BLOCKING (int)

Lance l'agent en mode non-bloquant.

GEARMAN_WORKER_GRAB_UNIQ (int)

Retourne l'identifiant unique alloué au client en plus du descripteur de tâche.

Configuration de base de 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)

add a note

User Contributed Notes 5 notes

up
7
ion dot dulgheru at gmail dot com
14 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
16 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
11 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
11 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
4 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)