Skip to main content

I am trying to use the StreamSets SDK python package to add labels to my data collectors. When I call the directory of the Control Hub instance, it shows an attribute “update_data_collector_labels”, it only takes one argument which is the data collector. Is there some syntax I am missing to be able to add the labels to this data collector? Does this functionality exist? or is there a workaround I could implement to achieve this?

 

Sample Code: 

from streamsets.sdk import DataCollector

from streamsets.sdk import ControlHub

control_hub = ControlHub(control_hub_link, username=username,password=password)

datacollectors= control_hub.data_collectors

data_collector= datacollectors.get()

#this line shows the current labels for the data collectors

control_hub.get_data_collector_labels(data_collector)

#the function only takes one argument. I was hoping I could use this line to update the data collector labels

control_hub.update_data_collector_labels(data_collector)

 

Thank you!

 

Hi @emily.suchan ,

 

Here is the sample code.

dc = sch.data_collectorss0]
test_labels = 'label-x', 'label-y']
dc.labels = test_labels
sch.update_data_collector_labels(dc)

Does this help?

 

Regards-

Kirti

 


Yes that helps, thank you!


Reply