MCPcopy Index your code
hub / github.com/diffgram/diffgram / new_deferred

Method new_deferred

shared/database/event/event.py:170–225  ·  view source on GitHub ↗

Keyword Arg Note: Any keyword args added here will be propagated to __new_event_threaded() __launch_new_event_threaded() AfterCommitAction Session is removed by default wait_for_commit is removed after wait

(session = None,
                     kind = None,
                     member_id = None,
                     success = None,
                     error_log = None,
                     description = None,
                     directory_id = None,
                     link = None,
                     project_id = None,
                     task_id = None,
                     job_id = None,
                     run_time = None,
                     email = None,
                     member = None,
                     input_id = None,
                     add_to_session = True,
                     flush_session = True,
                     file_id = None,
                     wait_for_commit = True)

Source from the content-addressed store, hash-verified

168
169 @staticmethod
170 def new_deferred(session = None,
171 kind = None,
172 member_id = None,
173 success = None,
174 error_log = None,
175 description = None,
176 directory_id = None,
177 link = None,
178 project_id = None,
179 task_id = None,
180 job_id = None,
181 run_time = None,
182 email = None,
183 member = None,
184 input_id = None,
185 add_to_session = True,
186 flush_session = True,
187 file_id = None,
188 wait_for_commit = True):
189 """
190 Keyword Arg Note:
191 Any keyword args added here will be propagated to
192 __new_event_threaded()
193 __launch_new_event_threaded()
194 AfterCommitAction
195
196 Session is removed by default
197 wait_for_commit is removed after waiting
198
199 Therefore to add/remove a keyword arg it needs 'only' 3 places:
200 new_deferred() argument
201 new() argument
202 new() Event() literal
203
204 This makes it relatively easy to read, and easier to add.
205 The assumption here is that the format of after_commit, and starting the thread
206 will change relatively slowly, but we expect we will wish to add new arguments
207
208 Try block because in general events are a "secondary" concern, so we don't
209 want to risk disrupting core operation if this fails for some reason
210 """
211
212 try:
213 event_args = locals()
214 event_args.pop('session', None) # Other downstream processes don't expect this key
215
216 if wait_for_commit:
217 event_args.pop('wait_for_commit', None)
218 if kind in ['task_created', 'task_completed', 'input_file_uploaded', 'task_template_completed']:
219 AfterCommitAction(session = session,
220 callback = Event.__launch_new_event_threaded,
221 callback_args = event_args)
222 else:
223 Event.__launch_new_event_threaded(**event_args)
224 except Exception as exception:
225 logger.error(str(exception))
226
227 @staticmethod

Callers 4

declare_successMethod · 0.80
newMethod · 0.80
update_job_statusMethod · 0.80

Calls 3

AfterCommitActionClass · 0.90
popMethod · 0.45

Tested by

no test coverage detected