### Navigation

- index
- modules |
- next |
- previous |
- IPython v0.10 documentation »
- The IPython API »

# kernel.taskfc

## Module: `kernel.taskfc`

Inheritance diagram for `IPython.kernel.taskfc`:

A Foolscap interface to a TaskController.

This class lets Foolscap clients talk to a TaskController.

## Classes

### `FCTaskClient`

class `IPython.kernel.taskfc.``FCTaskClient`(remote_reference)

  Bases: `object`

  Client class for Foolscap exposed TaskController.

  This class is an adapter that makes a RemoteReference to a TaskController look like an actual ITaskController on the client side.

  This class also implements IBlockingClientAdaptor so that clients can automatically get a blocking version of this class.

  `__init__`(remote_reference)
  `abort`(taskid)

    Abort a task by taskid.

    Parameters:

    taskid : int

      The taskid of the task to be aborted.

  `adapt_to_blocking_client`()
    Wrap self in a blocking version that implements `IBlockingTaskClient.
  `barrier`(taskids)

    Block until a set of tasks are completed.

    Parameters:

    taskids : list, tuple

      A sequence of taskids to block on.

  `clear`()

    Clear all previously run tasks from the task controller.

    This is needed because the task controller keep all task results in memory. This can be a problem is there are many completed tasks. Users should call this periodically to clean out these cached task results.

  `get_task_result`(taskid, block=False)

    Get a task result by taskid.

    Parameters:

    taskid : int

      The taskid of the task to be retrieved.

    block : boolean

      Should I block until the task is done?

    Returns: | A TaskResult object that encapsulates the task result.

  `map`(func, *sequences)

    Apply func to *sequences elementwise. Like Python’s builtin map.

    This version is load balanced.

  `mapper`(clear_before=False, clear_after=False, retries=0, recovery_task=None, depend=None, block=True)

    Create an IMapper implementer with a given set of arguments.

    The IMapper created using a task controller is load balanced.

    See the documentation for IPython.kernel.task.BaseTask for documentation on the arguments to this method.

  `parallel`(clear_before=False, clear_after=False, retries=0, recovery_task=None, depend=None, block=True)
  `queue_status`(verbose=False)

    Get a dictionary with the current state of the task queue.

    Parameters:

    verbose : boolean

      If True, return a list of taskids. If False, simply give the number of tasks with each status.

    Returns: | A dict with the queue status.

  `run`(task)

    Run a task on the TaskController.

    See the documentation of the MapTask and StringTask classes for details on how to build a task of different types.

    Parameters: | task : an ITask implementer
    Returns: | The int taskid of the submitted task. Pass this to get_task_result to get the TaskResult object.

  `spin`()

    Touch the scheduler, to resume scheduling without submitting a task.

    This method only needs to be called in unusual situations where the scheduler is idle for some reason.

  `unpackage`(r)

### `FCTaskControllerFromTaskController`

class `IPython.kernel.taskfc.``FCTaskControllerFromTaskController`(taskController)

  Bases: `foolscap.referenceable.Referenceable`

  Adapt a TaskController to an IFCTaskController

  This class is used to expose a TaskController over the wire using the Foolscap network protocol.

  `__init__`(taskController)
  `packageFailure`(f)
  `packageSuccess`(obj)
  `remote_abort`(taskid)
  `remote_barrier`(taskids)
  `remote_clear`()
  `remote_get_client_name`()
  `remote_get_task_result`(taskid, block=False)
  `remote_queue_status`(verbose)
  `remote_run`(ptask)
  `remote_spin`()

### `IFCTaskController`

class `IPython.kernel.taskfc.``IFCTaskController`(name, bases=(), attrs=None, __doc__=None, __module__=None)

  Bases: `zope.interface.Interface`

  Foolscap interface to task controller.

  See the documentation of ITaskController for more information.

  static `__init__`(name, bases=(), attrs=None, __doc__=None, __module__=None)

### Navigation

- index
- modules |
- next |
- previous |
- IPython v0.10 documentation »
- The IPython API »