コード例 #1
0
def workers():
    steps = [
        "enabled",
        "expiring",
        "group_names_percentage",
        "die_automatically",
        "traceback",
        "kill",
        "terminate",
        "disabled",
        "return_values",
        "discard",
    ]
    docs = Storage()
    comments = Storage()

    docs.disabled = """
#### Disable a worker
A disabled worker won't pick any tasks at all, but as soon as its status is set to **ACTIVE**
again, it will start to process tasks.

Instructions:
 - Push "Clear All"
 - Push "Start Monitoring"
 - If not yet, start a worker in another shell ``web2py.py -K w2p_scheduler_tests``
 - Wait a few seconds, a worker shows up
 - Push "Disable worker"
 - Wait a few seconds
 - Push "Queue task"
 - see that the task remain in the **QUEUED** status
 - Push "Activate worker"
 - the task get **ASSIGNED** and processed a few seconds later
    """
    docs.terminate = """
#### Terminate a worker
A worker with the status **TERMINATE** will die only if it's not processing any task.

Instructions:
 - Push "Clear All"
 - Push "Start Monitoring"
 - If not yet, start a worker in another shell ``web2py.py -K w2p_scheduler_tests``
 - Wait a few seconds, a worker shows up
 - Push "Queue task"
 - Wait until the task is reported as **RUNNING**
 - Quick!!! Click on "Terminate worker"
 - Watch the scheduler finish the current task and then die
    """
    docs.kill = """
#### Kill a worker
A worker with the status **KILL** will die also if it's processing a task.

Instructions:
 - Push "Clear All"
 - Push "Start Monitoring"
 - If not yet, start a worker in another shell ``web2py.py -K w2p_scheduler_tests``
 - Wait a few seconds, a worker shows up
 - Push "Queue task"
 - Wait until the task is reported as **RUNNING**
 - Quick!!! Click on "Kill worker"
 - Watch the scheduler die within 3 seconds
    """

    return dict(docs=docs, comments=comments)
コード例 #2
0
def workers():
    steps = ['enabled', 'expiring', 'group_names_percentage',
        'die_automatically', 'traceback', 'kill', 'terminate',
        'disabled', 'return_values', 'discard']
    docs = Storage()
    comments = Storage()

    docs.disabled = """
#### Disable a worker

A disabled worker won't pick any tasks at all, but as soon as its status is set to **ACTIVE**
again, it will start to process tasks.
------
Watch out: all the worker management functions take the group_name as an optional parameter. If you have a worker processing ``high_prio`` and ``low_prio``, ``scheduler.disable('high_prio')`` will disable the worker alltogether, even if you didn't want to terminate ``low_prio`` too.
------
``
scheduler.disable()
scheduler.resume()
``:code

Instructions:
 - Push "Clear All"
 - Push "Start Monitoring"
 - If not yet, start a worker in another shell ``web2py.py -K w2p_scheduler_tests``
 - Wait a few seconds, a worker shows up
 - Push "Disable worker"
 - Wait a few seconds
 - Push "Queue task"
 - see that the task remain in the **QUEUED** status
 - Push "Activate worker"
 - the task get **ASSIGNED** and processed a few seconds later
    """
    docs.terminate = """
#### Terminate a worker

A worker with the status **TERMINATE** will die only if it's not processing any task.

``
scheduler.terminate()
``:code

Instructions:
 - Push "Clear All"
 - Push "Start Monitoring"
 - If not yet, start a worker in another shell ``web2py.py -K w2p_scheduler_tests``
 - Wait a few seconds, a worker shows up
 - Push "Queue task"
 - Wait until the task is reported as **RUNNING**
 - Quick!!! Click on "Terminate worker"
 - Watch the scheduler finish the current task and then die
    """
    docs.kill = """
#### Kill a worker

A worker with the status **KILL** will die also if it's processing a task.

``
scheduler.kill()
``:code

Instructions:
 - Push "Clear All"
 - Push "Start Monitoring"
 - If not yet, start a worker in another shell ``web2py.py -K w2p_scheduler_tests``
 - Wait a few seconds, a worker shows up
 - Push "Queue task"
 - Wait until the task is reported as **RUNNING**
 - Quick!!! Click on "Kill worker"
 - Watch the scheduler die within 3 seconds
    """

    return dict(docs=docs, comments=comments)