Skip to content

Job_Watchdog

Job_Watchdog

DomoJob_Watchdog dataclass

DomoJob_Watchdog(
    auth: DomoAuth,
    id: str = None,
    raw: dict = dict(),
    name: str = None,
    application_id: str = None,
    logs_dataset_id: str = None,
    user_id: str = None,
    execution_timeout: int = 1440,
    is_enabled: bool = False,
    customer_id: str = None,
    created_dt: datetime = None,
    updated_dt: datetime = None,
    description: str = None,
    execution_payload: dict = dict(),
    share_state: dict = dict(),
    accounts: list[str] = list(),
    triggers: list[DomoTrigger] = list(),
    custom_message: str = None,
    remote_instance: str = None,
    notify_emails: list[str] = list(),
    notify_group_ids: list[str] = list(),
    notify_user_ids: list[str] = list(),
    Config: Watchdog_Config = None,
    webhooks: list[str] = None,
)

Bases: DomoJob_Base

create async classmethod

create(
    auth: DomoAuth,
    name: str,
    application_id: str,
    config: Watchdog_Config,
    logs_dataset_id: str,
    notify_user_ids: list | None = None,
    notify_group_ids: list | None = None,
    notify_emails: list | None = None,
    triggers: list[DomoTrigger_Schedule] | None = None,
    description: str = f"created via domolibrary - {today()}",
    execution_timeout=1440,
    accounts: list[int] | None = None,
    remote_instance=None,
    custom_message: str | None = None,
    webhooks: list[str] | None = None,
    debug_api: bool = False,
    session: AsyncClient | None = None,
    return_raw: bool = False,
    *,
    context: RouteContext | None = None,
    **context_kwargs,
)

Calls route

Source code in src/crew_dcs/classes/DomoApplication/Job_Watchdog.py
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
@classmethod
async def create(
    cls,
    auth: DomoAuth,
    name: str,
    application_id: str,
    config: Watchdog_Config,
    logs_dataset_id: str,
    notify_user_ids: list | None = None,
    notify_group_ids: list | None = None,
    notify_emails: list | None = None,
    triggers: list[DomoTrigger_Schedule] | None = None,
    description: str = f"created via domolibrary - {dt.date.today()}",
    execution_timeout=1440,
    accounts: list[int] | None = None,
    remote_instance=None,
    custom_message: str | None = None,
    webhooks: list[str] | None = None,
    debug_api: bool = False,
    session: httpx.AsyncClient | None = None,
    return_raw: bool = False,
    *,
    context: RouteContext | None = None,
    **context_kwargs,
):
    context = RouteContext.build_context(
        context=context,
        session=session,
        debug_api=debug_api,
        **context_kwargs,
    )

    domo_job = cls(
        auth=auth,
        name=name,
        description=description,
        application_id=application_id,
        execution_timeout=execution_timeout,
        notify_user_ids=notify_user_ids or [],
        notify_group_ids=notify_group_ids or [],
        notify_emails=notify_emails or [],
        triggers=triggers or [],
        accounts=accounts or [],
        logs_dataset_id=logs_dataset_id,
        remote_instance=remote_instance,
        Config=config,
        custom_message=custom_message,
        webhooks=webhooks,
    )

    body = domo_job.to_dict()

    res = await application_routes.create_application_job(
        auth=auth,
        application_id=application_id,
        body=body,
        context=context,
    )

    if return_raw:
        return res

    return cls.from_dict(res.response, auth=auth)

Watchdog_Config dataclass

Watchdog_Config(
    entity_ids: list[str],
    entity_type: str,
    watcher_parameters: dict,
    report_type: str,
)

Bases: ABC

report_type instance-attribute

report_type: str

base class for the different watchdog report types

execute async

execute(
    self,
    debug_api: bool = False,
    session: AsyncClient | None = None,
    debug_num_stacks_to_drop=2,
    *,
    context: RouteContext | None = None,
    **context_kwargs,
)

Calls route

Source code in src/crew_dcs/classes/DomoApplication/Job_Watchdog.py
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
async def execute(
    self,
    debug_api: bool = False,
    session: httpx.AsyncClient | None = None,
    debug_num_stacks_to_drop=2,
    *,
    context: RouteContext | None = None,
    **context_kwargs,
):
    context = RouteContext.build_context(
        context=context,
        session=session,
        debug_api=debug_api,
        debug_num_stacks_to_drop=debug_num_stacks_to_drop,
        **context_kwargs,
    )

    res = await application_routes.execute_application_job(
        auth=self.auth,
        application_id=self.application_id,
        job_id=self.id,
        context=context,
    )

    return res  # noqa: RET504

update async

update(
    self: DomoJob_Base,
    debug_api: bool = False,
    session: AsyncClient | None = None,
    debug_num_stacks_to_drop=2,
    *,
    context: RouteContext | None = None,
    **context_kwargs,
)

Calls route

Source code in src/crew_dcs/classes/DomoApplication/Job_Watchdog.py
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
async def update(
    self: DomoJob_Base,
    debug_api: bool = False,
    session: httpx.AsyncClient | None = None,
    debug_num_stacks_to_drop=2,
    *,
    context: RouteContext | None = None,
    **context_kwargs,
):
    context = RouteContext.build_context(
        context=context,
        session=session,
        debug_api=debug_api,
        debug_num_stacks_to_drop=debug_num_stacks_to_drop,
        **context_kwargs,
    )

    res = await application_routes.update_application_job(
        auth=self.auth,
        body=self.to_dict(),
        application_id=self.application_id,
        job_id=self.id,
        context=context,
    )

    return res  # noqa: RET504