Question

Streamsets SDK error


Hi 

I am trying to execute the python SDK code but am facing the below error. It works fine without the pipeline builder line of code.

Code:

import argparse
import os
from streamsets.sdk import ControlHub, DataCollector

def main(args):
    # Connect to the Control Hub instance you want to interact with, and show that the ControlHub object was
    # successfully created by displaying it's URL.

    sch = ControlHub("xxxxx", username=args.uid, password=args.pwd)
    print(sch.server_url)
    # Instantiate the PipelineBuilder instance to build the pipeline, and add stages to the pipeline.
    pipeline_builder = sch.get_pipeline_builder()
    #dc = DataCollector(server_url="xxxxxx", control_hub=sch)
    #builder = dc.get_pipeline_builder()

if __name__ == '__main__':
    os.environ['STREAMSETS_SDK_ACTIVATION_KEY'] = "xxxxxxx"
    parser = argparse.ArgumentParser()
    parser.add_argument("--uid", type=str, required=True, help='Type the Streamsets username')
    parser.add_argument("--pwd", type=str, required=True,help='Type the Streamsets Password')
    args = parser.parse_args()

    main(args)

 

Error:

 File "streamsets/sdk/sch_api.pyx", line 947, in sdk.sch_api.ApiClient.commit_pipeline
  File "streamsets/sdk/sch_api.pyx", line 3511, in sdk.sch_api.ApiClient._put
  File "streamsets/sdk/sch_api.pyx", line 3528, in sdk.sch_api.ApiClient._handle_http_error
requests.exceptions.HTTPError: {"ISSUES":[{"code":"PIPELINE_STORE_11","message":"Failed to create pipeline: java.net.ConnectException: Connection refused (Connection refused)"}]}

Process finished with exit code 1


2 replies

Thank you. Will check that.

Userlevel 4
Badge

Hi @Dimple , You are not passing the DataCollector instance to that get_pipeline_builder(), is your Control hub have any System SDC ? if not then you need pass datacollector for sdk.

https://docs.streamsets.com/sdk/latest/api/sch_api.html?highlight=get_pipeline_builde#streamsets.sdk.ControlHub.get_pipeline_builder

Reply