Skip to content

Commit

Permalink
add functionality
Browse files Browse the repository at this point in the history
  • Loading branch information
benclifford committed Oct 9, 2023
1 parent dfd4d85 commit 2c9d8f9
Showing 1 changed file with 16 additions and 1 deletion.
17 changes: 16 additions & 1 deletion parsl/dataflow/futures.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,12 @@
2. AppFutures which represent the futures on App/Leaf tasks.
"""
from __future__ import annotations

from concurrent.futures import Future
import logging
import threading
from typing import Optional, Sequence
from typing import Any, Optional, Sequence

from parsl.app.futures import DataFuture
from parsl.dataflow.taskrecord import TaskRecord
Expand Down Expand Up @@ -118,3 +119,17 @@ def task_status(self) -> str:
@property
def outputs(self) -> Sequence[DataFuture]:
return self._outputs

def __getitem__(self, key: Any) -> AppFuture:

# hack around circular imports for python_app
from parsl.app.app import python_app
deferred_getitem_app = python_app(deferred_getitem)

return deferred_getitem_app(self, key)

# this needs python_app to be importable, but three's an import loop
# if so... so hack around it for prototyping.
# @python_app
def deferred_getitem(o:Any, k: Any) -> Any:
return o[k]

0 comments on commit 2c9d8f9

Please sign in to comment.