def _move(self, pipeline: IPipeline, to_streamsets: IStreamSets): self.logger.info( f'Moving `{pipeline.get_id()}` from `{pipeline.get_streamsets().get_url()}` to `{to_streamsets.get_url()}`' ) should_start = client.get_pipeline_status(pipeline) in [ IPipeline.STATUS_STARTING, IPipeline.STATUS_RUNNING ] client.delete(pipeline) pipeline.set_streamsets(to_streamsets) client.create(pipeline) self.pipeline_provider.save(pipeline) if should_start: client.start(pipeline) self.streamsets_pipelines[to_streamsets].append(pipeline)
def create(pipeline: IPipeline): # todo remove this if check and make streamsets mandatory after that fix todos above if not pipeline.get_streamsets(): pipeline.set_streamsets( balancer.least_loaded_streamsets( balancer.get_streamsets_pipelines())) try: _client(pipeline).create_pipeline(pipeline.get_id()) except ApiClientException as e: raise StreamsetsException(str(e)) try: _update_pipeline(pipeline, set_offset=True) except ApiClientException as e: delete(pipeline) raise StreamsetsException(str(e)) except Exception: delete(pipeline) raise