Exemple #1
0
def process_watch(tube):
    """The "watch" command adds the named tube to the watch list for the current
    connection. A reserve command will take a job from any of the tubes in the
    watch list. For each new connection, the watch list initially consists of one
    tube, named "default"""
    check_name(tube)
    return 'watch {}\r\n'.format(tube)
Exemple #2
0
def process_stats_tube(tube):
    """The stats-tube command gives statistical information about the
    specified tube if it exists. The response is one of:

        "NOT_FOUND\r\n" if the tube does not exist.
        "OK <bytes>\r\n<data>\r\n"

    <bytes> is the size of the following data section in bytes.
    <data> is a sequence of bytes of length <bytes> from the previous line. It
     is a YAML file with statistical information represented a dictionary.

    :param tube: ``str`` is a name at most 200 bytes. Stats will be returned
        for this tube.
    """
    check_name(tube)
    return 'stats-tube {}\r\n'.format(tube)
Exemple #3
0
def process_ignore(tube):
    """The "ignore" command is for consumers. It removes the named tube from the
    watch list for the current connection"""
    check_name(tube)
    return 'ignore {}\r\n'.format(tube)
Exemple #4
0
def process_use(tube):
    """The "use" command is for producers. Subsequent put commands will put jobs into
    the tube specified by this command. If no use command has been issued, jobs
    will be put into the tube named "default"."""
    check_name(tube)
    return 'use {}\r\n'.format(tube)
Exemple #5
0
 def test_check_name_(self):
     # should not raise any exceptions
     check_name("xxx")