Skip to main content
  • Please make sure all the jobs are in inactive state.
  • Changes following parameters as per the environment:-
  1. <CONTROL_HUB_URL> = Controlhub URL
  2. <USERNAME> =  admin username
  3. <PASSWORD> = password
  4. <OLD_LABEL> = old label
  5. <NEW_LABEL>= new label 
from streamsets.sdk import ControlHub,DataCollector


DataCollector.VERIFY_SSL_CERTIFICATES = False
sch = ControlHub('<CONTROL_HUB_URL>',
username='USERNAME',

password='PASSWORD')


jobs_with_existing_label = sch.jobs.get_all(data_collector_labels=s'<OLD_LABEL>'])
print(f'jobs_with_existing_label = \n {jobs_with_existing_label}')



for job in jobs_with_existing_label:
job.data_collector_labels = ='<NEW_LABEL>']
sch.update_job(job)

 

 

Be the first to reply!

Reply