@@ -252,14 +252,15 @@ def update_metadata(self, metadata_name, metadata_value, is_privileged_metadata=
252252
253253 # session related API calls
254254 # only valid if the workflow has at least one session function
255- def send_to_running_function_in_session (self , rgid , message , send_now = False ):
255+ def send_to_running_function_in_session (self , rgid , message , send_now = False , session_metadata = None ):
256256 '''
257257 Send a message to a long-running session function instance identified with its id in this session.
258258
259259 Args:
260260 rgid (string): the running long-running session function instance's id.
261261 message (*): the message to be sent; can be any python data type (<type 'dict', 'list', 'str', 'int', 'float', or 'NoneType'>).
262262 send_now (boolean): whether the message should be sent immediately or at the end of current function's execution; default: False.
263+ session_metadata (string): (optional) the running long-running session function instance's metadata
263264
264265 Returns:
265266 None
@@ -280,7 +281,7 @@ def send_to_running_function_in_session(self, rgid, message, send_now=False):
280281
281282 if self ._is_session_workflow :
282283 self ._session_utils .send_to_running_function_in_session (
283- rgid , message , send_now )
284+ rgid , message , send_now , session_metadata )
284285 else :
285286 self ._logger .warning (
286287 "Cannot send a session update message in a workflow with no session functions." )
@@ -767,6 +768,32 @@ def get_all_session_function_ids(self):
767768 "Cannot get session function ids in a workflow with no session functions." )
768769 return rgidlist
769770
771+ def get_all_session_metadata (self ):
772+ '''
773+ Retrieve a dict of metadata related to all ids of the session function instances in this session.
774+
775+ Args:
776+ None
777+
778+ Returns:
779+ Dict of id (string) -> metadata (string) of all the session function instances in this session.
780+
781+ Warns:
782+ When the calling function is not part of a workflow with at least one session function.
783+
784+ Note:
785+ The usage of this function is only possible with a KNIX-specific feature (i.e., session functions).
786+ Using a KNIX-specific feature might make the workflow description incompatible with other platforms.
787+
788+ '''
789+ session_metadata_dict = {}
790+ if self ._is_session_workflow :
791+ session_metadata_dict = self ._session_utils .get_all_session_metadata ()
792+ else :
793+ self ._logger .warning (
794+ "Cannot get session metadata in a workflow with no session functions." )
795+ return session_metadata_dict
796+
770797 def is_still_running (self ):
771798 '''
772799 Retrieve the status of this session function instance.
0 commit comments