parsl.dataflow.futures.AppFuture

class parsl.dataflow.futures.AppFuture(task_record: TaskRecord)[source]

An AppFuture wraps a sequence of Futures which may fail and be retried.

The AppFuture will wait for the DFK to provide a result from an appropriate parent future, through parent_callback. It will set its result to the result of that parent future, if that parent future completes without an exception. This result setting should cause .result(), .exception() and done callbacks to fire as expected.

The AppFuture will not set its result to the result of the parent future, if that parent future completes with an exception, and if that parent future has retries left. In that case, no result(), exception() or done callbacks should report a result.

The AppFuture will set its result to the result of the parent future, if that parent future completes with an exception and if that parent future has no retries left, or if it has no retry field. .result(), .exception() and done callbacks should give a result as expected when a Future has a result set

The parent future may return a RemoteExceptionWrapper as a result and AppFuture will treat this an an exception for the above retry and result handling behaviour.

__init__(task_record: TaskRecord) None[source]

Initialize the AppFuture.

Args:

KWargs:
  • task_record : The TaskRecord for the task represented by this future.

Methods

__init__(task_record)

Initialize the AppFuture.

add_done_callback(fn)

Attaches a callable that will be called when the future finishes.

cancel()

Cancel the future if possible.

cancelled()

Return True if the future was cancelled.

done()

Return True if the future was cancelled or finished executing.

exception([timeout])

Return the exception raised by the call that the future represents.

result([timeout])

Return the result of the call that the future represents.

running()

Return True if the future is currently executing.

set_exception(exception)

Sets the result of the future as being the given exception.

set_result(result)

Sets the return value of work associated with the future.

set_running_or_notify_cancel()

Mark the future as running or process any cancel notifications.

task_status()

Returns the status of the task that will provide the value for this future.

Attributes

outputs

stderr

Return app stderr.

stdout

Return app stdout.

tid

cancel() bool[source]

Cancel the future if possible.

Returns True if the future was cancelled, False otherwise. A future cannot be cancelled if it is running or has already completed.

cancelled() bool[source]

Return True if the future was cancelled.

property outputs: Sequence[DataFuture][source]
property stderr: None | str | DataFuture[source]

Return app stderr. If stdout was specified as a string, then this property will return that string. If stdout was specified as a File, then this property will return a DataFuture representing that file stageout. TODO: this can be a tuple too I think?

property stdout: None | str | DataFuture[source]

Return app stdout. If stdout was specified as a string, then this property will return that string. If stdout was specified as a File, then this property will return a DataFuture representing that file stageout. TODO: this can be a tuple too I think?

task_status() str[source]

Returns the status of the task that will provide the value for this future. This may not be in-sync with the result state of this future - for example, task_status might return ‘done’ but self.done() might not be true (which in turn means self.result() and self.exception() might block).

The actual status description strings returned by this method are likely to change over subsequent versions of parsl, as use-cases and infrastructure are worked out.

It is expected that the status values will be from a limited set of strings (so that it makes sense, for example, to group and count statuses from many futures).

It is expected that might be a non-trivial cost in acquiring the status in future (for example, by communicating with a remote worker).

Returns: str

property tid: int[source]