Python API - Job log URL

Options
JohnB
JohnB Registered Posts: 32 ✭✭✭✭✭

Is there a way to fetch the URL to any job log on the DSS server?

I know how to fetch the log string itself but I'm searching for a way to display a link to the log outside of DSS using the dataikuapi package

Best Answer

  • KimmyC
    KimmyC Dataiker Posts: 34 Dataiker
    Answer ✓
    Options

    Hi,

    Please note that job logs are not actual URL endpoint on the server but are actually stored in DSS data directory itself.

    That being said, instead of displaying the link to the log, you could consider using get_log method from our Python API to retrieve the entire log for a particular job. The sample code below would retrieve the log for a specific job within a specific project:

    import dataiku
    from dataiku import pandasutils as pdu
    import pandas as pdclient = dataiku.api_client()

    project = client.get_project("your_project_id")
    job = project.get_job("job_id")
    job.get_log()

    Hope this helps!

Answers

  • JohnB
    JohnB Registered Posts: 32 ✭✭✭✭✭
    Options

    Hi,

    Unfortunately in this case, I can't use that solution. I was aware of get_log but I'd rather just put the link to the log in an email alert rather than the whole content.

    I'm developing an external alerter that will cover several projects, which are developed by a different team.

    I know about the reporter functionality but I would like to develop something that does not interfere with another team's project and would be scheduled from another [non-DSS] application.

    It looks like I can deduce the path from most of the job details e.g.


    .../dip/api/scenarios/step-run-log?projectKey=MY_PROJECT&scenarioId=my_scenario&runId=2020-03-04-22-20-03-123&stepRunId=build_flowitem_2020-03-04-22-20-03-416

    However the last piece "build_flowitem" that is prepended to the stepRunId is eluding me at the moment; this string changes depending on the job type.

Setup Info
    Tags
      Help me…