Job

A job refers to a scheduled task in an application.

For the purposes of this beta class, the only Job type implemented has been Watchdog. This class will be heavily revised in a future development sprint.

An additional Job type might be PDP Automation Toolkit.

token_auth = dmda.DomoTokenAuth(
    domo_instance="domo-alpha",
    domo_access_token=os.environ["ALPHA_ACCESS_TOKEN"],
)

DomoJob_Watchdog


source

Watchdog_Config

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

source

Watchdog_Config_CustomQuery

 Watchdog_Config_CustomQuery (entity_ids:List[str], entity_type:str,
                              watcher_parameters:dict,
                              report_type:str='custom_query',
                              sql_query:str='')

source

Watchdog_Config_LastDataUpdated

 Watchdog_Config_LastDataUpdated (entity_ids:List[str], entity_type:str,
                                  watcher_parameters:dict,
                                  report_type:str='last_data_updated', min
                                  _data_update_frequency_in_mins:int=10)

source

Watchdog_Config_ErrorDetection

 Watchdog_Config_ErrorDetection (entity_ids:List[str], entity_type:str,
                                 watcher_parameters:dict,
                                 report_type:str='error_detection')

source

Watchdog_Config_ExecutionVariance

 Watchdog_Config_ExecutionVariance (entity_ids:List[str], entity_type:str,
                                    watcher_parameters:dict,
                                    report_type:str,
                                    variance_percent:int=10)

source

Watchdog_Config_RowCountVariance

 Watchdog_Config_RowCountVariance (entity_ids:List[str], entity_type:str,
                                   watcher_parameters:dict,
                                   report_type:str,
                                   variance_percent:int=10)

source

Watchdog_Config__Variance

 Watchdog_Config__Variance (entity_ids:List[str], entity_type:str,
                            watcher_parameters:dict, report_type:str,
                            variance_percent:int=10)

source

Watchdog_Config_MaxIndexingTime

 Watchdog_Config_MaxIndexingTime (entity_ids:List[str], entity_type:str,
                                  watcher_parameters:dict,
                                  report_type:str)

source

Watchdog_ConfigFactory

 Watchdog_ConfigFactory (value, names=None, module=None, qualname=None,
                         type=None, start=1)

An enumeration.

obj = {
    "entityIds": [
        "39ee901e-ab22-4c7c-aab2-010c80da8d52",
        "384ef8ba-0782-4062-be99-671fa46badd7",
    ],
    "type": "custom_query",
    "entityType": "DATA_SOURCE",
    "sqlQuery": "SELECT * FROM TABLE",
}

s = Watchdog_ConfigFactory[obj["type"].upper()].value._from_json(obj)

s.to_json()
{'entityIds': ['39ee901e-ab22-4c7c-aab2-010c80da8d52',
  '384ef8ba-0782-4062-be99-671fa46badd7'],
 'entityType': 'DATA_SOURCE',
 'type': 'custom_query',
 'sqlQuery': 'SELECT * FROM TABLE'}

source

DomoJob_Watchdog

 DomoJob_Watchdog (auth:domolibrary.client.DomoAuth.DomoAuth, name:str,
                   application_id:str, logs_dataset_id:str=None,
                   id:str=None, user_id:str=None,
                   execution_timeout:int=1440, is_enabled:bool=False,
                   customer_id:str=None,
                   created_dt:datetime.datetime=None,
                   updated_dt:datetime.datetime=None,
                   description:str=None, execution_payload:dict=<factory>,
                   share_state:dict=<factory>,
                   accounts:List[str]=<factory>, triggers:List[domolibrary
                   .classes.DomoApplication_Job_Base.DomoTrigger]=<factory
                   >, custom_message:str=None, remote_instance:str=None,
                   notify_emails:List[str]=<factory>,
                   notify_group_ids:List[str]=<factory>,
                   notify_user_ids:List[str]=<factory>,
                   Config:__main__.Watchdog_Config=None,
                   webhooks:List[str]=None)
token_auth = dmda.DomoTokenAuth(
    domo_instance="domo-alpha",
    domo_access_token=os.environ["ALPHA_ACCESS_TOKEN"],
)

res = await application_routes.get_applications(auth=token_auth)

application_id = next(
    (
        app["applicationId"]
        for app in res.response
        if app["name"] == "Toolkit: Data Watchdog"
    )
)

res = await application_routes.get_application_jobs(
    application_id=application_id, auth=token_auth
)
job_id = res.response[0]["jobId"]


test_job = await DomoJob_Watchdog.get_by_id(
    job_id=job_id,
    application_id=application_id,
    auth=token_auth,
    return_raw=False,
)

pprint(test_job.to_json())
{'accounts': [],
 'applicationId': '33aab8f0-3397-45e1-933c-755abd0f5b3a',
 'customerId': 'domo-alpha',
 'executionPayload': {'customMessage': None,
                      'domain': None,
                      'metricsDatasetId': 'a58f8f4c-5174-496d-928d-510846a3e6fc',
                      'notifyEmailAddresses': [],
                      'notifyGroupIds': [],
                      'notifyUserIds': [1623162654],
                      'watcherParameters': {'entityIds': ['56ecc63a-a967-4e43-8250-1a3c360f9792'],
                                            'entityType': 'DATA_SOURCE',
                                            'type': 'execution_variance',
                                            'variancePercent': 30},
                      'webhooks': None},
 'executionTimeout': 1440,
 'jobDescription': 'updated on 2025-02-18',
 'jobId': 'e3de115f-576b-4839-a60e-6268c507e32b',
 'jobName': 'does it work?',
 'shareState': {'sharedEntities': [{'accessLevel': 'OWNER',
                                    'id': '1623162654',
                                    'type': 'USER'}]},
 'triggers': [{'eventEntity': '0 32 1/1 ? * *',
               'eventType': 'scheduleTriggered'}],
 'userId': 1623162654}

Domo Job CRUD Operations

sample update

test_job.description = f"updated on {dt.date.today()}"

await test_job.update()
ResponseGetData(status=200, response={'jobId': 'e3de115f-576b-4839-a60e-6268c507e32b', 'applicationId': '33aab8f0-3397-45e1-933c-755abd0f5b3a', 'customerId': 'domo-alpha', 'jobName': 'does it work?', 'jobDescription': 'updated on 2025-02-18', 'userId': 1623162654, 'executionTimeout': 1440, 'jobStatus': 'idle', 'executionPayload': {'webhooks': None, 'domain': None, 'watcherParameters': {'entityIds': ['56ecc63a-a967-4e43-8250-1a3c360f9792'], 'entityType': 'DATA_SOURCE', 'type': 'execution_variance', 'variancePercent': 30}, 'customMessage': None, 'metricsDatasetId': 'a58f8f4c-5174-496d-928d-510846a3e6fc', 'notifyUserIds': [1623162654], 'notifyEmailAddresses': [], 'notifyGroupIds': []}, 'executionResponse': {}, 'accounts': [], 'executionClass': 'com.domo.executor.datawatchdog.DataWatchdogExecutor', 'created': 1710803700000, 'updated': 1739891693000, 'statusChanged': 1739891345000, 'triggers': [], 'compressPayload': False}, is_success=True, parent_class=None)

sample execute

await test_job.execute()
ResponseGetData(status=200, response={'requestedBy': 1623162654, 'queuedJobs': [{'jobId': 'e3de115f-576b-4839-a60e-6268c507e32b', 'applicationId': '33aab8f0-3397-45e1-933c-755abd0f5b3a', 'executionId': '8f870d3a-b04d-4066-92f5-99a1792c5340', 'customerId': 'domo-alpha', 'jobName': 'does it work?', 'jobDescription': 'updated on 2025-02-18', 'userId': 1623162654, 'executionTimeout': 1440, 'jobStatus': 'idle', 'executionPayload': {'webhooks': None, 'domain': None, 'watcherParameters': {'entityIds': ['56ecc63a-a967-4e43-8250-1a3c360f9792'], 'entityType': 'DATA_SOURCE', 'type': 'execution_variance', 'variancePercent': 30}, 'customMessage': None, 'metricsDatasetId': 'a58f8f4c-5174-496d-928d-510846a3e6fc', 'notifyUserIds': [1623162654], 'notifyEmailAddresses': [], 'notifyGroupIds': []}, 'executionResponse': {}, 'accounts': [], 'executionClass': 'com.domo.executor.datawatchdog.DataWatchdogExecutor', 'created': 1710803700000, 'updated': 1739891693000, 'statusChanged': 1739891345000, 'triggers': [], 'compressPayload': False}]}, is_success=True, parent_class=None)
token_auth = dmda.DomoTokenAuth(
    domo_instance="domo-alpha",
    domo_access_token=os.environ["ALPHA_ACCESS_TOKEN"],
)

config = Watchdog_Config_ExecutionVariance._from_json(
    {
        "entityIds": [
            "56ecc63a-a967-4e43-8250-1a3c360f9792",
        ],
        "entityType": "DATA_SOURCE",
        "type": "execution_variance",
        "variancePercent": 30,
    }
)


# await DomoJob_Watchdog.create(
#     auth=token_auth,
#     application_id="33aab8f0-3397-45e1-933c-755abd0f5b3a",
#     config=config,
#     notify_user_ids=[1623162654],
#     name="does it work?",
#     logs_dataset_id="a58f8f4c-5174-496d-928d-510846a3e6fc",
#     return_raw=False,
# )