- Please make sure all the jobs are in inactive state.
- Changes following parameters as per the environment:-
- <CONTROL_HUB_URL> = Controlhub URL
- <USERNAME> = admin username
- <PASSWORD> = password
- <OLD_LABEL> = old label
- <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)