<spanid="evennia-scripts-taskhandler"></span><h1>evennia.scripts.taskhandler<aclass="headerlink"href="#module-evennia.scripts.taskhandler"title="Permalink to this headline">¶</a></h1>
<p>Module containing the task handler for Evennia deferred tasks, persistent or not.</p>
<dlclass="py function">
<dtid="evennia.scripts.taskhandler.handle_error">
<codeclass="sig-prename descclassname">evennia.scripts.taskhandler.</code><codeclass="sig-name descname">handle_error</code><spanclass="sig-paren">(</span><emclass="sig-param"><spanclass="o">*</span><spanclass="n">args</span></em>, <emclass="sig-param"><spanclass="o">**</span><spanclass="n">kwargs</span></em><spanclass="sig-paren">)</span><aclass="reference internal"href="../_modules/evennia/scripts/taskhandler.html#handle_error"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink"href="#evennia.scripts.taskhandler.handle_error"title="Permalink to this definition">¶</a></dt>
<emclass="property">class </em><codeclass="sig-prename descclassname">evennia.scripts.taskhandler.</code><codeclass="sig-name descname">TaskHandlerTask</code><spanclass="sig-paren">(</span><emclass="sig-param"><spanclass="n">task_id</span></em><spanclass="sig-paren">)</span><aclass="reference internal"href="../_modules/evennia/scripts/taskhandler.html#TaskHandlerTask"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink"href="#evennia.scripts.taskhandler.TaskHandlerTask"title="Permalink to this definition">¶</a></dt>
<codeclass="sig-name descname">pause</code><spanclass="sig-paren">(</span><spanclass="sig-paren">)</span><aclass="reference internal"href="../_modules/evennia/scripts/taskhandler.html#TaskHandlerTask.pause"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink"href="#evennia.scripts.taskhandler.TaskHandlerTask.pause"title="Permalink to this definition">¶</a></dt>
<codeclass="sig-name descname">unpause</code><spanclass="sig-paren">(</span><spanclass="sig-paren">)</span><aclass="reference internal"href="../_modules/evennia/scripts/taskhandler.html#TaskHandlerTask.unpause"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink"href="#evennia.scripts.taskhandler.TaskHandlerTask.unpause"title="Permalink to this definition">¶</a></dt>
<dd><p>Process all callbacks made since pause() was called.</p>
<codeclass="sig-name descname">do_task</code><spanclass="sig-paren">(</span><spanclass="sig-paren">)</span><aclass="reference internal"href="../_modules/evennia/scripts/taskhandler.html#TaskHandlerTask.do_task"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink"href="#evennia.scripts.taskhandler.TaskHandlerTask.do_task"title="Permalink to this definition">¶</a></dt>
<codeclass="sig-name descname">call</code><spanclass="sig-paren">(</span><spanclass="sig-paren">)</span><aclass="reference internal"href="../_modules/evennia/scripts/taskhandler.html#TaskHandlerTask.call"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink"href="#evennia.scripts.taskhandler.TaskHandlerTask.call"title="Permalink to this definition">¶</a></dt>
<codeclass="sig-name descname">remove</code><spanclass="sig-paren">(</span><spanclass="sig-paren">)</span><aclass="reference internal"href="../_modules/evennia/scripts/taskhandler.html#TaskHandlerTask.remove"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink"href="#evennia.scripts.taskhandler.TaskHandlerTask.remove"title="Permalink to this definition">¶</a></dt>
<codeclass="sig-name descname">cancel</code><spanclass="sig-paren">(</span><spanclass="sig-paren">)</span><aclass="reference internal"href="../_modules/evennia/scripts/taskhandler.html#TaskHandlerTask.cancel"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink"href="#evennia.scripts.taskhandler.TaskHandlerTask.cancel"title="Permalink to this definition">¶</a></dt>
<dd><p>Stop a task from automatically executing.</p>
<codeclass="sig-name descname">active</code><spanclass="sig-paren">(</span><spanclass="sig-paren">)</span><aclass="reference internal"href="../_modules/evennia/scripts/taskhandler.html#TaskHandlerTask.active"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink"href="#evennia.scripts.taskhandler.TaskHandlerTask.active"title="Permalink to this definition">¶</a></dt>
<dd><p>Check if a task is active (has not been called yet).</p>
<codeclass="sig-name descname">exists</code><spanclass="sig-paren">(</span><spanclass="sig-paren">)</span><aclass="reference internal"href="../_modules/evennia/scripts/taskhandler.html#TaskHandlerTask.exists"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink"href="#evennia.scripts.taskhandler.TaskHandlerTask.exists"title="Permalink to this definition">¶</a></dt>
<codeclass="sig-name descname">get_id</code><spanclass="sig-paren">(</span><spanclass="sig-paren">)</span><aclass="reference internal"href="../_modules/evennia/scripts/taskhandler.html#TaskHandlerTask.get_id"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink"href="#evennia.scripts.taskhandler.TaskHandlerTask.get_id"title="Permalink to this definition">¶</a></dt>
<dd><p>Returns the global id for this task. For use with</p>
<codeclass="sig-name descname">__init__</code><spanclass="sig-paren">(</span><emclass="sig-param"><spanclass="n">task_id</span></em><spanclass="sig-paren">)</span><aclass="reference internal"href="../_modules/evennia/scripts/taskhandler.html#TaskHandlerTask.__init__"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink"href="#evennia.scripts.taskhandler.TaskHandlerTask.__init__"title="Permalink to this definition">¶</a></dt>
<dd><p>Initialize self. See help(type(self)) for accurate signature.</p>
<codeclass="sig-name descname">get_deferred</code><spanclass="sig-paren">(</span><spanclass="sig-paren">)</span><aclass="reference internal"href="../_modules/evennia/scripts/taskhandler.html#TaskHandlerTask.get_deferred"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink"href="#evennia.scripts.taskhandler.TaskHandlerTask.get_deferred"title="Permalink to this definition">¶</a></dt>
<dd><p>Return the instance of the deferred the task id is using.</p>
<dlclass="field-list simple">
<dtclass="field-odd">Returns</dt>
<ddclass="field-odd"><p><p><em>bool or deferred</em>–</p>
<dlclass="simple">
<dt>An instance of a deferred or False if there is no task with the id.</dt><dd><p>None is returned if there is no deferred affiliated with this id.</p>
</dd>
</dl>
</p>
</dd>
</dl>
</dd></dl>
<dlclass="py method">
<dtid="id0">
<codeclass="sig-name descname">pause</code><spanclass="sig-paren">(</span><spanclass="sig-paren">)</span><aclass="reference internal"href="../_modules/evennia/scripts/taskhandler.html#TaskHandlerTask.pause"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink"href="#id0"title="Permalink to this definition">¶</a></dt>
<dd><p>Pause the callback of a task.
To resume use <strong>TaskHandlerTask.unpause</strong>.</p>
</dd></dl>
<dlclass="py method">
<dtid="id1">
<codeclass="sig-name descname">unpause</code><spanclass="sig-paren">(</span><spanclass="sig-paren">)</span><aclass="reference internal"href="../_modules/evennia/scripts/taskhandler.html#TaskHandlerTask.unpause"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink"href="#id1"title="Permalink to this definition">¶</a></dt>
<dd><p>Unpause a task, run the task if it has passed delay time.</p>
<emclass="property">property </em><codeclass="sig-name descname">paused</code><aclass="headerlink"href="#evennia.scripts.taskhandler.TaskHandlerTask.paused"title="Permalink to this definition">¶</a></dt>
<dd><p>A task attribute to check if the deferred instance of a task has been paused.</p>
<p>This exists to mock usage of a twisted deferred object.</p>
<dlclass="field-list simple">
<dtclass="field-odd">Returns</dt>
<ddclass="field-odd"><p><p><em>bool or None</em>–</p>
<dlclass="simple">
<dt>True if the task was properly paused. None if the task does not have</dt><dd><p>a deferred instance.</p>
</dd>
</dl>
</p>
</dd>
</dl>
</dd></dl>
<dlclass="py method">
<dtid="id2">
<codeclass="sig-name descname">do_task</code><spanclass="sig-paren">(</span><spanclass="sig-paren">)</span><aclass="reference internal"href="../_modules/evennia/scripts/taskhandler.html#TaskHandlerTask.do_task"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink"href="#id2"title="Permalink to this definition">¶</a></dt>
<dd><p>Execute the task (call its callback).
If calling before timedelay, cancel the deferred instance affliated to this task.
Remove the task from the dictionary of current tasks on a successful
callback.</p>
<dlclass="field-list simple">
<dtclass="field-odd">Returns</dt>
<ddclass="field-odd"><p><em>bool or any</em>– Set to <strong>False</strong> if the task does not exist in task
handler. Otherwise it will be the return of the task’s callback.</p>
</dd>
</dl>
</dd></dl>
<dlclass="py method">
<dtid="id3">
<codeclass="sig-name descname">call</code><spanclass="sig-paren">(</span><spanclass="sig-paren">)</span><aclass="reference internal"href="../_modules/evennia/scripts/taskhandler.html#TaskHandlerTask.call"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink"href="#id3"title="Permalink to this definition">¶</a></dt>
<dd><p>Call the callback of a task.
Leave the task unaffected otherwise.
This does not use the task’s deferred instance.
The only requirement is that the task exist in task handler.</p>
<dlclass="field-list simple">
<dtclass="field-odd">Returns</dt>
<ddclass="field-odd"><p><em>bool or any</em>– Set to <strong>False</strong> if the task does not exist in task
handler. Otherwise it will be the return of the task’s callback.</p>
</dd>
</dl>
</dd></dl>
<dlclass="py method">
<dtid="id4">
<codeclass="sig-name descname">remove</code><spanclass="sig-paren">(</span><spanclass="sig-paren">)</span><aclass="reference internal"href="../_modules/evennia/scripts/taskhandler.html#TaskHandlerTask.remove"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink"href="#id4"title="Permalink to this definition">¶</a></dt>
<dd><p>Remove a task without executing it.
Deletes the instance of the task’s deferred.</p>
<dlclass="field-list simple">
<dtclass="field-odd">Parameters</dt>
<ddclass="field-odd"><p><strong>task_id</strong> (<em>int</em>) – an existing task ID.</p>
</dd>
<dtclass="field-even">Returns</dt>
<ddclass="field-even"><p><em>bool</em>– True if the removal completed successfully.</p>
</dd>
</dl>
</dd></dl>
<dlclass="py method">
<dtid="id5">
<codeclass="sig-name descname">cancel</code><spanclass="sig-paren">(</span><spanclass="sig-paren">)</span><aclass="reference internal"href="../_modules/evennia/scripts/taskhandler.html#TaskHandlerTask.cancel"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink"href="#id5"title="Permalink to this definition">¶</a></dt>
<dd><p>Stop a task from automatically executing.
This will not remove the task.</p>
<dlclass="field-list simple">
<dtclass="field-odd">Returns</dt>
<ddclass="field-odd"><p><p><em>bool</em>–</p>
<dlclass="simple">
<dt>True if the cancel completed successfully.</dt><dd><p>False if the cancel did not complete successfully.</p>
</dd>
</dl>
</p>
</dd>
</dl>
</dd></dl>
<dlclass="py method">
<dtid="id6">
<codeclass="sig-name descname">active</code><spanclass="sig-paren">(</span><spanclass="sig-paren">)</span><aclass="reference internal"href="../_modules/evennia/scripts/taskhandler.html#TaskHandlerTask.active"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink"href="#id6"title="Permalink to this definition">¶</a></dt>
<dd><p>Check if a task is active (has not been called yet).</p>
<dlclass="field-list simple">
<dtclass="field-odd">Returns</dt>
<ddclass="field-odd"><p><p><em>bool</em>–</p>
<dlclass="simple">
<dt>True if a task is active (has not been called yet). False if</dt><dd><p>it is not (has been called) or if the task does not exist.</p>
<emclass="property">property </em><codeclass="sig-name descname">called</code><aclass="headerlink"href="#evennia.scripts.taskhandler.TaskHandlerTask.called"title="Permalink to this definition">¶</a></dt>
<dd><p>A task attribute to check if the deferred instance of a task has been called.</p>
<p>This exists to mock usage of a twisted deferred object.
It will not set to True if Task.call has been called. This only happens if
task’s deferred instance calls the callback.</p>
<dlclass="field-list simple">
<dtclass="field-odd">Returns</dt>
<ddclass="field-odd"><p><p><em>bool</em>–</p>
<dlclass="simple">
<dt>True if the deferred instance of this task has called the callback.</dt><dd><p>False if the deferred instnace of this task has not called the callback.</p>
</dd>
</dl>
</p>
</dd>
</dl>
</dd></dl>
<dlclass="py method">
<dtid="id7">
<codeclass="sig-name descname">exists</code><spanclass="sig-paren">(</span><spanclass="sig-paren">)</span><aclass="reference internal"href="../_modules/evennia/scripts/taskhandler.html#TaskHandlerTask.exists"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink"href="#id7"title="Permalink to this definition">¶</a></dt>
<dd><p>Check if a task exists.
Most task handler methods check for existence for you.</p>
<dlclass="field-list simple">
<dtclass="field-odd">Returns</dt>
<ddclass="field-odd"><p><em>bool</em>– True the task exists False if it does not.</p>
</dd>
</dl>
</dd></dl>
<dlclass="py method">
<dtid="id8">
<codeclass="sig-name descname">get_id</code><spanclass="sig-paren">(</span><spanclass="sig-paren">)</span><aclass="reference internal"href="../_modules/evennia/scripts/taskhandler.html#TaskHandlerTask.get_id"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink"href="#id8"title="Permalink to this definition">¶</a></dt>
<dd><p>Returns the global id for this task. For use with
<ddclass="field-odd"><p><em>task_id (int)</em>– global task id for this task.</p>
</dd>
</dl>
</dd></dl>
</dd></dl>
<dlclass="py class">
<dtid="evennia.scripts.taskhandler.TaskHandler">
<emclass="property">class </em><codeclass="sig-prename descclassname">evennia.scripts.taskhandler.</code><codeclass="sig-name descname">TaskHandler</code><aclass="reference internal"href="../_modules/evennia/scripts/taskhandler.html#TaskHandler"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink"href="#evennia.scripts.taskhandler.TaskHandler"title="Permalink to this definition">¶</a></dt>
<codeclass="sig-name descname">__init__</code><spanclass="sig-paren">(</span><spanclass="sig-paren">)</span><aclass="reference internal"href="../_modules/evennia/scripts/taskhandler.html#TaskHandler.__init__"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink"href="#evennia.scripts.taskhandler.TaskHandler.__init__"title="Permalink to this definition">¶</a></dt>
<dd><p>Initialize self. See help(type(self)) for accurate signature.</p>
<codeclass="sig-name descname">load</code><spanclass="sig-paren">(</span><spanclass="sig-paren">)</span><aclass="reference internal"href="../_modules/evennia/scripts/taskhandler.html#TaskHandler.load"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink"href="#evennia.scripts.taskhandler.TaskHandler.load"title="Permalink to this definition">¶</a></dt>
<dd><p>Load from the ServerConfig.</p>
<p>This should be automatically called when Evennia starts.
It populates <strong>self.tasks</strong> according to the ServerConfig.</p>
<codeclass="sig-name descname">clean_stale_tasks</code><spanclass="sig-paren">(</span><spanclass="sig-paren">)</span><aclass="reference internal"href="../_modules/evennia/scripts/taskhandler.html#TaskHandler.clean_stale_tasks"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink"href="#evennia.scripts.taskhandler.TaskHandler.clean_stale_tasks"title="Permalink to this definition">¶</a></dt>
<dd><p>remove uncalled but canceled from task handler.</p>
<p>By default this will not occur until a canceled task
has been uncalled for 60 second after the time it should have been called.
To adjust this time use TASK_HANDLER.stale_timeout.</p>
<codeclass="sig-name descname">save</code><spanclass="sig-paren">(</span><spanclass="sig-paren">)</span><aclass="reference internal"href="../_modules/evennia/scripts/taskhandler.html#TaskHandler.save"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink"href="#evennia.scripts.taskhandler.TaskHandler.save"title="Permalink to this definition">¶</a></dt>
<codeclass="sig-name descname">add</code><spanclass="sig-paren">(</span><emclass="sig-param"><spanclass="n">timedelay</span></em>, <emclass="sig-param"><spanclass="n">callback</span></em>, <emclass="sig-param"><spanclass="o">*</span><spanclass="n">args</span></em>, <emclass="sig-param"><spanclass="o">**</span><spanclass="n">kwargs</span></em><spanclass="sig-paren">)</span><aclass="reference internal"href="../_modules/evennia/scripts/taskhandler.html#TaskHandler.add"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink"href="#evennia.scripts.taskhandler.TaskHandler.add"title="Permalink to this definition">¶</a></dt>
<dd><p>Add a new task.</p>
<p>If the persistent kwarg is truthy:
The callback, args and values for kwarg will be serialized. Type
and attribute errors during the serialization will be logged,
but will not throw exceptions.
For persistent tasks do not use memory references in the callback
function or arguments. After a restart those memory references are no
longer accurate.</p>
<dlclass="field-list simple">
<dtclass="field-odd">Parameters</dt>
<ddclass="field-odd"><ulclass="simple">
<li><p><strong>timedelay</strong> (<em>int</em><em> or </em><em>float</em>) – time in seconds before calling the callback.</p></li>
<li><p><strong>callback</strong> (<em>function</em><em> or </em><em>instance method</em>) – the callback itself</p></li>
<li><p><strong>any</strong> (<em>any</em>) – any additional positional arguments to send to the callback</p></li>
<li><p><strong>*args</strong>– positional arguments to pass to callback.</p></li>
<li><p><strong>**kwargs</strong>–<p>keyword arguments to pass to callback.
- persistent (bool, optional): persist the task (stores it).</p>
<blockquote>
<div><p>Persistent key and value is removed from kwargs it will
<codeclass="sig-name descname">exists</code><spanclass="sig-paren">(</span><emclass="sig-param"><spanclass="n">task_id</span></em><spanclass="sig-paren">)</span><aclass="reference internal"href="../_modules/evennia/scripts/taskhandler.html#TaskHandler.exists"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink"href="#evennia.scripts.taskhandler.TaskHandler.exists"title="Permalink to this definition">¶</a></dt>
<dd><p>Check if a task exists.
Most task handler methods check for existence for you.</p>
<dlclass="field-list simple">
<dtclass="field-odd">Parameters</dt>
<ddclass="field-odd"><p><strong>task_id</strong> (<em>int</em>) – an existing task ID.</p>
</dd>
<dtclass="field-even">Returns</dt>
<ddclass="field-even"><p><em>bool</em>– True the task exists False if it does not.</p>
<codeclass="sig-name descname">active</code><spanclass="sig-paren">(</span><emclass="sig-param"><spanclass="n">task_id</span></em><spanclass="sig-paren">)</span><aclass="reference internal"href="../_modules/evennia/scripts/taskhandler.html#TaskHandler.active"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink"href="#evennia.scripts.taskhandler.TaskHandler.active"title="Permalink to this definition">¶</a></dt>
<dd><p>Check if a task is active (has not been called yet).</p>
<dlclass="field-list simple">
<dtclass="field-odd">Parameters</dt>
<ddclass="field-odd"><p><strong>task_id</strong> (<em>int</em>) – an existing task ID.</p>
</dd>
<dtclass="field-even">Returns</dt>
<ddclass="field-even"><p><p><em>bool</em>–</p>
<dlclass="simple">
<dt>True if a task is active (has not been called yet). False if</dt><dd><p>it is not (has been called) or if the task does not exist.</p>
<codeclass="sig-name descname">cancel</code><spanclass="sig-paren">(</span><emclass="sig-param"><spanclass="n">task_id</span></em><spanclass="sig-paren">)</span><aclass="reference internal"href="../_modules/evennia/scripts/taskhandler.html#TaskHandler.cancel"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink"href="#evennia.scripts.taskhandler.TaskHandler.cancel"title="Permalink to this definition">¶</a></dt>
<dd><p>Stop a task from automatically executing.
This will not remove the task.</p>
<dlclass="field-list simple">
<dtclass="field-odd">Parameters</dt>
<ddclass="field-odd"><p><strong>task_id</strong> (<em>int</em>) – an existing task ID.</p>
</dd>
<dtclass="field-even">Returns</dt>
<ddclass="field-even"><p><p><em>bool</em>–</p>
<dlclass="simple">
<dt>True if the cancel completed successfully.</dt><dd><p>False if the cancel did not complete successfully.</p>
<codeclass="sig-name descname">remove</code><spanclass="sig-paren">(</span><emclass="sig-param"><spanclass="n">task_id</span></em><spanclass="sig-paren">)</span><aclass="reference internal"href="../_modules/evennia/scripts/taskhandler.html#TaskHandler.remove"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink"href="#evennia.scripts.taskhandler.TaskHandler.remove"title="Permalink to this definition">¶</a></dt>
<dd><p>Remove a task without executing it.
Deletes the instance of the task’s deferred.</p>
<dlclass="field-list simple">
<dtclass="field-odd">Parameters</dt>
<ddclass="field-odd"><p><strong>task_id</strong> (<em>int</em>) – an existing task ID.</p>
</dd>
<dtclass="field-even">Returns</dt>
<ddclass="field-even"><p><em>bool</em>– True if the removal completed successfully.</p>
<codeclass="sig-name descname">clear</code><spanclass="sig-paren">(</span><emclass="sig-param"><spanclass="n">save</span><spanclass="o">=</span><spanclass="default_value">True</span></em>, <emclass="sig-param"><spanclass="n">cancel</span><spanclass="o">=</span><spanclass="default_value">True</span></em><spanclass="sig-paren">)</span><aclass="reference internal"href="../_modules/evennia/scripts/taskhandler.html#TaskHandler.clear"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink"href="#evennia.scripts.taskhandler.TaskHandler.clear"title="Permalink to this definition">¶</a></dt>
<dd><p>Clear all tasks. By default tasks are canceled and removed from the database as well.</p>
<dlclass="field-list simple">
<dtclass="field-odd">Parameters</dt>
<ddclass="field-odd"><ulclass="simple">
<li><p><strong>save=True</strong> (<em>bool</em>) – Should changes to persistent tasks be saved to database.</p></li>
<li><p><strong>cancel=True</strong> (<em>bool</em>) – Cancel scheduled tasks before removing it from task handler.</p></li>
</ul>
</dd>
<dtclass="field-even">Returns</dt>
<ddclass="field-even"><p><em>True (bool)</em>– if the removal completed successfully.</p>
<codeclass="sig-name descname">call_task</code><spanclass="sig-paren">(</span><emclass="sig-param"><spanclass="n">task_id</span></em><spanclass="sig-paren">)</span><aclass="reference internal"href="../_modules/evennia/scripts/taskhandler.html#TaskHandler.call_task"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink"href="#evennia.scripts.taskhandler.TaskHandler.call_task"title="Permalink to this definition">¶</a></dt>
<dd><p>Call the callback of a task.
Leave the task unaffected otherwise.
This does not use the task’s deferred instance.
The only requirement is that the task exist in task handler.</p>
<dlclass="field-list simple">
<dtclass="field-odd">Parameters</dt>
<ddclass="field-odd"><p><strong>task_id</strong> (<em>int</em>) – an existing task ID.</p>
</dd>
<dtclass="field-even">Returns</dt>
<ddclass="field-even"><p><em>bool or any</em>– Set to <strong>False</strong> if the task does not exist in task
handler. Otherwise it will be the return of the task’s callback.</p>
<codeclass="sig-name descname">do_task</code><spanclass="sig-paren">(</span><emclass="sig-param"><spanclass="n">task_id</span></em><spanclass="sig-paren">)</span><aclass="reference internal"href="../_modules/evennia/scripts/taskhandler.html#TaskHandler.do_task"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink"href="#evennia.scripts.taskhandler.TaskHandler.do_task"title="Permalink to this definition">¶</a></dt>
<dd><p>Execute the task (call its callback).
If calling before timedelay cancel the deferred instance affliated to this task.
Remove the task from the dictionary of current tasks on a successful
callback.</p>
<dlclass="field-list simple">
<dtclass="field-odd">Parameters</dt>
<ddclass="field-odd"><p><strong>task_id</strong> (<em>int</em>) – a valid task ID.</p>
</dd>
<dtclass="field-even">Returns</dt>
<ddclass="field-even"><p><em>bool or any</em>– Set to <strong>False</strong> if the task does not exist in task
handler. Otherwise it will be the return of the task’s callback.</p>
<codeclass="sig-name descname">get_deferred</code><spanclass="sig-paren">(</span><emclass="sig-param"><spanclass="n">task_id</span></em><spanclass="sig-paren">)</span><aclass="reference internal"href="../_modules/evennia/scripts/taskhandler.html#TaskHandler.get_deferred"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink"href="#evennia.scripts.taskhandler.TaskHandler.get_deferred"title="Permalink to this definition">¶</a></dt>
<dd><p>Return the instance of the deferred the task id is using.</p>
<dlclass="field-list simple">
<dtclass="field-odd">Parameters</dt>
<ddclass="field-odd"><p><strong>task_id</strong> (<em>int</em>) – a valid task ID.</p>
</dd>
<dtclass="field-even">Returns</dt>
<ddclass="field-even"><p><p><em>bool or deferred</em>–</p>
<dlclass="simple">
<dt>An instance of a deferred or False if there is no task with the id.</dt><dd><p>None is returned if there is no deferred affiliated with this id.</p>
<codeclass="sig-name descname">create_delays</code><spanclass="sig-paren">(</span><spanclass="sig-paren">)</span><aclass="reference internal"href="../_modules/evennia/scripts/taskhandler.html#TaskHandler.create_delays"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink"href="#evennia.scripts.taskhandler.TaskHandler.create_delays"title="Permalink to this definition">¶</a></dt>
<dd><p>Create the delayed tasks for the persistent tasks.
This method should be automatically called when Evennia starts.</p>