Skip to content

Commit

Permalink
feat: Add cancel_session method to class SessionFieldFilter (#430)
Browse files Browse the repository at this point in the history
  • Loading branch information
dbrasseur-aneo committed Oct 16, 2023
2 parents 475c14a + 080161a commit 3b4b1ff
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion packages/python/src/armonik/client/sessions.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

from ..protogen.client.sessions_service_pb2_grpc import SessionsStub
from ..protogen.common.submitter_common_pb2 import SessionFilter
from ..protogen.common.sessions_common_pb2 import GetSessionRequest, GetSessionResponse, ListSessionsRequest, ListSessionsResponse, SessionRaw
from ..protogen.common.sessions_common_pb2 import GetSessionRequest, GetSessionResponse, ListSessionsRequest, ListSessionsResponse, SessionRaw, CancelSessionRequest, CancelSessionResponse
from ..protogen.common.sessions_filters_pb2 import Filters as rawFilters, FiltersAnd as rawFilterAnd, FilterField as rawFilterField, FilterStatus as rawFilterStatus
from ..protogen.common.sessions_fields_pb2 import *
from ..common.filter import StringFilter, StatusFilter, DateFilter, NumberFilter, Filter
Expand Down Expand Up @@ -64,3 +64,12 @@ def list_sessions(self, task_filter: Filter, page: int = 0, page_size: int = 100
)
list_response : ListSessionsResponse = self._client.ListSessions(request)
return list_response.total, [Session.from_message(t) for t in list_response.sessions]

def cancel_session(self, session_id: str) -> None:
"""Cancel a session
Args:
session_id: Id of the session to b cancelled
"""
self._client.CancelSession(CancelSessionRequest(session_id=session_id))

0 comments on commit 3b4b1ff

Please sign in to comment.