Skip to content

Commit bea4ae7

Browse files
change notify_user
1 parent 2d497bb commit bea4ae7

File tree

1 file changed

+11
-11
lines changed

1 file changed

+11
-11
lines changed

oc/od/orchestrator.py

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -4789,9 +4789,8 @@ def create_thread_to_notify_user_application_pulled( self, myDesktop:ODDesktop,
47894789
if event_received['pulled'] is still False
47904790
'''
47914791
assert isinstance(event_received, dict), f"event_received has invalid type {type(event_received)}"
4792-
assert isinstance(myDesktop, ODDesktop), f"desktop has invalid type {type(myDesktop)}"
4793-
assert isinstance(data, dict), f"data has invalid type {type(data)}"
4794-
self.logger.debug( '')
4792+
assert isinstance(myDesktop, ODDesktop), f"desktop has invalid type {type(myDesktop)}"
4793+
assert isinstance(data, dict), f"data has invalid type {type(data)}"
47954794
notify_thread=threading.Thread(target=self.notify_user_application_pulled, args=[myDesktop, data, event_received] )
47964795
notify_thread.start()
47974796
return notify_thread
@@ -4803,9 +4802,9 @@ def notify_user_application_pulled( self, myDesktop:ODDesktop, data:dict, event_
48034802
if event_received['pulled'] is still False
48044803
'''
48054804
assert isinstance(event_received, dict), f"event_received has invalid type {type(event_received)}"
4806-
assert isinstance(myDesktop, ODDesktop), f"desktop has invalid type {type(myDesktop)}"
4807-
assert isinstance(data, dict), f"data has invalid type {type(data)}"
4808-
self.logger.debug( '')
4805+
assert isinstance(myDesktop, ODDesktop), f"desktop has invalid type {type(myDesktop)}"
4806+
assert isinstance(data, dict), f"data has invalid type {type(data)}"
4807+
self.logger.debug('')
48094808
self.logger.debug( f'event_received={event_received} before sleep for {oc.od.settings.desktop['K8S_NOTIFY_USER_APPLICATION_PULLED_DELAY_SECONDS']}' )
48104809
time.sleep( oc.od.settings.desktop['K8S_NOTIFY_USER_APPLICATION_PULLED_DELAY_SECONDS'] )
48114810
if event_received.get('pulled') is False:
@@ -5155,8 +5154,9 @@ def thread_to_watch_for_end_of_pod_initializing( self, myDesktop:ODDesktop, pod_
51555154
self.orchestrator.notify_user( myDesktop, 'container', data )
51565155

51575156
if isinstance(c.state.terminated, V1ContainerStateTerminated ):
5158-
data['message'] = c.state.terminated.reason
5159-
self.orchestrator.notify_user( myDesktop, 'container', data )
5157+
if c.state.terminated.reason != 'Completed':
5158+
data['message'] = c.state.terminated.reason
5159+
self.orchestrator.notify_user( myDesktop, 'container', data )
51605160

51615161
'''
51625162
elif isinstance(c.state.running, V1ContainerStateRunning ):
@@ -5255,22 +5255,22 @@ def thread_to_watch_for_pulling_event( self, myDesktop:ODDesktop, pod_name:str,
52555255
# event_object.first_timestamp
52565256
# self.orchestrator.notify_user( myDesktop, 'container', data )
52575257
self.create_thread_to_notify_user_application_pulled( myDesktop, data, event_received )
5258-
w.stop()
52595258
continue
5260-
5259+
52615260
elif event_object.reason == 'Pulled':
52625261
event_received['pulled'] = True # for the thread notify_user_application_pulled
52635262
if event_received.get('pulling.notify_user') is True:
52645263
data['name'] = event_object.reason
52655264
data['message'] = event_object.message
52665265
self.orchestrator.notify_user( myDesktop, 'container', data )
5266+
w.stop()
52675267
continue
52685268

52695269
elif event_object.reason == 'Started':
52705270
# always stop the watch on Started event
52715271
w.stop()
52725272
continue
5273-
5273+
52745274
elif event_object.reason == 'Created':
52755275
pass # nothing to do
52765276

0 commit comments

Comments
 (0)