MCPcopy Create free account
hub / github.com/intelowlproject/IntelOwl / create

Method create

api_app/queryset.py:258–279  ·  view source on GitHub ↗

Creates a job, setting it as a child of the specified parent if provided. Args: parent (optional): The parent job, if any. **kwargs: The fields to set on the created job. Returns: The created job.

(self, parent=None, **kwargs)

Source from the content-addressed store, hash-verified

256 """
257
258 def create(self, parent=None, **kwargs):
259 """
260 Creates a job, setting it as a child of the specified parent if provided.
261
262 Args:
263 parent (optional): The parent job, if any.
264 **kwargs: The fields to set on the created job.
265
266 Returns:
267 The created job.
268 """
269 if parent:
270 return parent.add_child(**kwargs)
271 # try multiple times hoping to for no race conditions
272 total_attempt_number = 5
273 for attempt in range(0, total_attempt_number):
274 try:
275 return self.model.add_root(**kwargs)
276 except IntegrityError:
277 logger.warning(f"Found race condition for {kwargs['name']}. Trying again to calculate path.")
278 if attempt == total_attempt_number - 1:
279 raise
280
281 def delete(self, *args, **kwargs):
282 """

Callers 15

setUpMethod · 0.45
_create_job_from_fileMethod · 0.45
setUpTestDataMethod · 0.45
test_retry_204Method · 0.45
test_remove_old_jobsMethod · 0.45
setUpClassMethod · 0.45
setUpMethod · 0.45

Calls

no outgoing calls