Question

Jobs logs using python sdk

  • 18 April 2023
  • 2 replies
  • 37 views

I want to fetch job logs using python sdk. Is there any way to do this?


2 replies

Userlevel 5
Badge +1

@chandrakant_v 

 

Kindly try the below code and let me know if it helps.

from streamsets.sdk import ControlHub
sch = ControlHub(credential_id='your_crediential_id', token='your_token_id')
sdc = sch.data_collectors.get(url='http://your_data_collector_hostname:18630')

builder = sch.get_pipeline_builder(engine_type='data_collector', engine_id=sdc.id)

job_id = "my_job_id"

job = builder.get_job(job_id)

logs = job.get_logs()

print(logs)

Thanks & Regards

Bikram_

this didn’t work as builder doesn’t have get_job method.

Reply