SF initial configurator | 1508907 | 2022-10-06 13:33:19 +0300 | [diff] [blame^] | 1 | # Copyright 2013 OpenStack Foundation |
| 2 | # |
| 3 | # Licensed under the Apache License, Version 2.0 (the "License"); you may |
| 4 | # not use this file except in compliance with the License. You may obtain |
| 5 | # a copy of the License at |
| 6 | # |
| 7 | # http://www.apache.org/licenses/LICENSE-2.0 |
| 8 | # |
| 9 | # Unless required by applicable law or agreed to in writing, software |
| 10 | # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT |
| 11 | # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the |
| 12 | # License for the specific language governing permissions and limitations |
| 13 | # under the License. |
| 14 | |
| 15 | """ |
| 16 | Protocol Constants |
| 17 | ================== |
| 18 | |
| 19 | These are not necessary for normal API usage. See the `Gearman |
| 20 | protocol reference <http://gearman.org/protocol>`_ for an explanation |
| 21 | of each of these. |
| 22 | |
| 23 | Magic Codes |
| 24 | ----------- |
| 25 | |
| 26 | .. py:data:: REQ |
| 27 | |
| 28 | The Gearman magic code for a request. |
| 29 | |
| 30 | .. py:data:: RES |
| 31 | |
| 32 | The Gearman magic code for a response. |
| 33 | |
| 34 | Packet Types |
| 35 | ------------ |
| 36 | |
| 37 | """ |
| 38 | |
| 39 | types = { |
| 40 | 1: 'CAN_DO', |
| 41 | 2: 'CANT_DO', |
| 42 | 3: 'RESET_ABILITIES', |
| 43 | 4: 'PRE_SLEEP', |
| 44 | # unused |
| 45 | 6: 'NOOP', |
| 46 | 7: 'SUBMIT_JOB', |
| 47 | 8: 'JOB_CREATED', |
| 48 | 9: 'GRAB_JOB', |
| 49 | 10: 'NO_JOB', |
| 50 | 11: 'JOB_ASSIGN', |
| 51 | 12: 'WORK_STATUS', |
| 52 | 13: 'WORK_COMPLETE', |
| 53 | 14: 'WORK_FAIL', |
| 54 | 15: 'GET_STATUS', |
| 55 | 16: 'ECHO_REQ', |
| 56 | 17: 'ECHO_RES', |
| 57 | 18: 'SUBMIT_JOB_BG', |
| 58 | 19: 'ERROR', |
| 59 | 20: 'STATUS_RES', |
| 60 | 21: 'SUBMIT_JOB_HIGH', |
| 61 | 22: 'SET_CLIENT_ID', |
| 62 | 23: 'CAN_DO_TIMEOUT', |
| 63 | 24: 'ALL_YOURS', |
| 64 | 25: 'WORK_EXCEPTION', |
| 65 | 26: 'OPTION_REQ', |
| 66 | 27: 'OPTION_RES', |
| 67 | 28: 'WORK_DATA', |
| 68 | 29: 'WORK_WARNING', |
| 69 | 30: 'GRAB_JOB_UNIQ', |
| 70 | 31: 'JOB_ASSIGN_UNIQ', |
| 71 | 32: 'SUBMIT_JOB_HIGH_BG', |
| 72 | 33: 'SUBMIT_JOB_LOW', |
| 73 | 34: 'SUBMIT_JOB_LOW_BG', |
| 74 | 35: 'SUBMIT_JOB_SCHED', |
| 75 | 36: 'SUBMIT_JOB_EPOCH', |
| 76 | } |
| 77 | |
| 78 | for i, name in types.items(): |
| 79 | globals()[name] = i |
| 80 | __doc__ += '\n.. py:data:: %s\n' % name |
| 81 | |
| 82 | REQ = b'\x00REQ' |
| 83 | RES = b'\x00RES' |