summaryrefslogtreecommitdiff
path: root/gear/constants.py
blob: e10eba4391ab0d0dea5f93bcd05ac07adc07c5ab (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
# Copyright 2013 OpenStack Foundation
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
#      http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.

"""
Protocol Constants
==================

These are not necessary for normal API usage.  See the `Gearman
protocol reference <http://gearman.org/protocol>`_ for an explanation
of each of these.

Magic Codes
-----------

.. py:data:: REQ

   The Gearman magic code for a request.

.. py:data:: RES

   The Gearman magic code for a response.

Packet Types
------------

"""

types = {
    1: 'CAN_DO',
    2: 'CANT_DO',
    3: 'RESET_ABILITIES',
    4: 'PRE_SLEEP',
    #unused
    6: 'NOOP',
    7: 'SUBMIT_JOB',
    8: 'JOB_CREATED',
    9: 'GRAB_JOB',
    10: 'NO_JOB',
    11: 'JOB_ASSIGN',
    12: 'WORK_STATUS',
    13: 'WORK_COMPLETE',
    14: 'WORK_FAIL',
    15: 'GET_STATUS',
    16: 'ECHO_REQ',
    17: 'ECHO_RES',
    18: 'SUBMIT_JOB_BG',
    19: 'ERROR',
    20: 'STATUS_RES',
    21: 'SUBMIT_JOB_HIGH',
    22: 'SET_CLIENT_ID',
    23: 'CAN_DO_TIMEOUT',
    24: 'ALL_YOURS',
    25: 'WORK_EXCEPTION',
    26: 'OPTION_REQ',
    27: 'OPTION_RES',
    28: 'WORK_DATA',
    29: 'WORK_WARNING',
    30: 'GRAB_JOB_UNIQ',
    31: 'JOB_ASSIGN_UNIQ',
    32: 'SUBMIT_JOB_HIGH_BG',
    33: 'SUBMIT_JOB_LOW',
    34: 'SUBMIT_JOB_LOW_BG',
    35: 'SUBMIT_JOB_SCHED',
    36: 'SUBMIT_JOB_EPOCH',
}

for i, name in types.items():
    globals()[name] = i
    __doc__ += '\n.. py:data:: %s\n' % name

REQ = b'\x00REQ'
RES = b'\x00RES'