Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

create Action for twinapi execution #8765

Merged
merged 2 commits into from
Apr 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
9 changes: 8 additions & 1 deletion packages/syft/src/syft/node/node.py
Original file line number Diff line number Diff line change
Expand Up @@ -1252,7 +1252,14 @@ def add_api_endpoint_execution_to_queue(
has_execute_permissions=True,
worker_pool=worker_pool_ref, # set worker pool reference as part of queue item
)
return self.add_queueitem_to_queue(queue_item, credentials, None, None)

action = Action.from_api_endpoint_execution()
return self.add_queueitem_to_queue(
queue_item,
credentials,
action,
None,
)

def add_action_to_queue(
self,
Expand Down
11 changes: 11 additions & 0 deletions packages/syft/src/syft/service/action/action_object.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ class ActionType(Enum):
FUNCTION = 8
CREATEOBJECT = 16
SYFTFUNCTION = 32
TWINAPI = 64


def repr_cls(c: Any) -> str:
Expand Down Expand Up @@ -199,6 +200,16 @@ def from_api_call(cls, api_call: SyftAPICall) -> Action:
)
return action

@classmethod
def from_api_endpoint_execution(cls: type[Self]) -> Action:
return cls(
args=[],
kwargs={},
result_id=LineageID(),
action_type=ActionType.TWINAPI,
user_code_id=None,
)

def __repr__(self) -> str:
def repr_uid(_id: LineageID) -> str:
return f"{str(_id)[:3]}..{str(_id)[-1]}"
Expand Down