[
https://issues.apache.org/jira/browse/BEAM-13812?focusedWorklogId=727896&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-727896
]
ASF GitHub Bot logged work on BEAM-13812:
-----------------------------------------
Author: ASF GitHub Bot
Created on: 15/Feb/22 22:47
Start Date: 15/Feb/22 22:47
Worklog Time Spent: 10m
Work Description: VictorPlusC commented on a change in pull request
#16741:
URL: https://github.com/apache/beam/pull/16741#discussion_r807382129
##########
File path: sdks/python/apache_beam/runners/interactive/interactive_beam.py
##########
@@ -329,6 +359,101 @@ def record(self, pipeline):
return recording_manager.record_pipeline()
+class Clusters():
+ """An interface for users to modify the pipelines that are being run by the
+ Interactive Environment.
+
+ Methods of the Interactive Beam Clusters class can be accessed via:
+ interactive_beam.clusters
+
+ Example of calling the Interactive Beam clusters describe method::
+ interactive_beam.clusters.describe()
+ """
+ def __init__(self) -> None:
+ """Instantiates default values for Dataproc cluster interactions.
+ """
+ self._default_cluster_name = 'interactive-beam-cluster'
+ self._master_urls = bidict()
+ self._dataproc_cluster_managers = {}
+ self._master_urls_to_pipelines = {}
+
+ def describe(self, pipeline: Optional[beam.Pipeline]=None) -> dict:
+ """Returns a description of the cluster associated to the given pipeline.
+
+ If no pipeline is given then this returns a dictionary of descriptions for
+ all pipelines.
+ """
+
+ description = ie.current_env().describe_all_clusters()
Review comment:
Moved, thanks.
##########
File path:
sdks/python/apache_beam/runners/interactive/interactive_environment.py
##########
@@ -258,31 +274,53 @@ def inspector_with_synthetic(self):
synthetic variables generated by Interactive Beam. Internally used."""
return self._inspector_with_synthetic
+ def cleanup_pipeline(self, pipeline):
+ from apache_beam.runners.interactive import background_caching_job as bcj
+ bcj.attempt_to_cancel_background_caching_job(pipeline)
+ bcj.attempt_to_stop_test_stream_service(pipeline)
+ cache_manager = self.get_cache_manager(pipeline)
+ # Recording manager performs cache manager cleanup during eviction, so we
+ # don't need to clean it up here.
+ if cache_manager and self.get_recording_manager(pipeline) is None:
+ cache_manager.cleanup()
+ if self.options.cleanup_cluster:
+ cluster_manager = self.get_dataproc_cluster_manager(pipeline)
+ if cluster_manager:
+ master_url = cluster_manager.master_url
+ if len(self.clusters.get_pipelines_using_master_url(master_url)) > 1:
+ _LOGGER.warning(
+ 'Cluster is currently being used, skipping deletion.')
+ else:
+ cluster_manager.cleanup()
+
+ def cleanup_environment(self):
+ for _, job in self._background_caching_jobs.items():
+ if job:
+ job.cancel()
+ for _, controller in self._test_stream_service_controllers.items():
+ if controller:
+ controller.stop()
+ for pipeline_id, cache_manager in self._cache_managers.items():
+ # Recording manager performs cache manager cleanup during eviction, so
+ # we don't need to clean it up here.
+ if cache_manager and pipeline_id not in self._recording_managers:
+ cache_manager.cleanup()
+ if self.options.cleanup_cluster:
Review comment:
Changed, thanks.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
Issue Time Tracking
-------------------
Worklog Id: (was: 727896)
Time Spent: 8h 40m (was: 8.5h)
> Integrate DataprocClusterManager into Interactive Environment
> -------------------------------------------------------------
>
> Key: BEAM-13812
> URL: https://issues.apache.org/jira/browse/BEAM-13812
> Project: Beam
> Issue Type: New Feature
> Components: runner-py-interactive
> Reporter: Victor Chen
> Assignee: Victor Chen
> Priority: P2
> Time Spent: 8h 40m
> Remaining Estimate: 0h
>
> * Adds code to automatically create a Dataproc cluster configured with Docker
> and Flink if a user instantiates an InteractiveRunner using
> underlying_runner='FlinkRunner'
> * By default, the created Dataproc cluster will be called
> 'interactive-beam-cluster' and will be cleaned up when the Interactive
> Environment is interrupted
> * Users will be able to toggle an automatic deletion of the cluster with the
> default name, 'interactive-beam-cluster' when the kernel is interrupted
> * Introduces the Clusters class in interactive_beam.py, which acts as a user
> interface that provides the user with the following capabilities:
> ** Changing the default name of the clusters created by Interactive Beam
> ** Cleaning up a cluster by providing a corresponding pipeline, an option to
> force the deletion is provided, in the case where more than one pipeline use
> the same cluster
> ** Getting all pipelines that use the provided master_url
> ** Receiving a description back for either the cluster corresponding to a
> specific pipeline, or the descriptions of all pipelines
--
This message was sent by Atlassian Jira
(v8.20.1#820001)