Self-Managed Environments#


When using a self-managed environment, you take full control of procuring the resources needed to run and deploy engine instances. A self-managed environment can represent local on-premises machines or cloud computing instances.

For more details, refer to the StreamSets Platform Documentation.

Creating a Self-Managed Environment#


The SDK is designed to mirror the UI workflow. This section shows you how to create a Self-Manged environment in the UI and how to achieve the same using StreamSets Platform SDK for Python code step by step.

Define Environment#

In the UI, an environment is defined as seen below:

../../../_images/creation_define_environment3.png

The same effect can be achieved by using the SDK as seen below:

environment_builder = sch.get_environment_builder(environment_type='SELF')

environment = environment_builder.build(environment_name='Self-managed-environment',
                                        environment_tags=['self-managed-tag'],
                                        allow_nightly_engine_builds=False)

Review and Launch#

In the UI, an environment can be reviewed and launched as seen below:

../../../_images/creation_review_and_activate1.png

The same effect can be achieved by using the SDK as seen below:

sch.add_environment(environment)
# Optional - equivalent to clicking on 'Activate & Exit'
sch.activate_environment(environment)

Complete example for Self-Managed Environment#


To create a new streamsets.sdk.sch_models.SelfManagedEnvironment object and add it to Control Hub, use the streamsets.sdk.sch_models.EnvironmentBuilder class. Use the streamsets.sdk.ControlHub.get_environment_builder() method to instantiate the builder object:

environment_builder = sch.get_environment_builder(environment_type='SELF')

Next, build the environment by using streamsets.sdk.sch_models.EnvironmentBuilder.build() method, and pass the resulting environment object to the streamsets.sdk.ControlHub.add_environment() method:

environment = environment_builder.build(environment_name='Self-managed-environment',
                                        environment_tags=['self-managed-tag'],
                                        allow_nightly_engine_builds=False)
sch.add_environment(environment)
# Optional - equivalent to clicking on 'Activate & Exit'
sch.activate_environment(environment)