Esempio n. 1
0
    def Run(self, args):
        dataproc = dp.Dataproc(self.ReleaseTrack())

        cluster_ref = args.CONCEPTS.cluster.Parse()

        request = dataproc.messages.DataprocProjectsRegionsClustersGetRequest(
            projectId=cluster_ref.projectId,
            region=cluster_ref.region,
            clusterName=cluster_ref.clusterName)

        cluster = dataproc.client.projects_regions_clusters.Get(request)

        # Filter out Dataproc-generated labels.
        clusters.DeleteGeneratedLabels(cluster, dataproc)

        schema_path = self.GetSchemaPath()
        if args.destination:
            with files.FileWriter(args.destination) as stream:
                export_util.Export(message=cluster,
                                   stream=stream,
                                   schema_path=schema_path)
        else:
            export_util.Export(message=cluster,
                               stream=sys.stdout,
                               schema_path=schema_path)
    def Run(self, args):
        dataproc = dp.Dataproc(self.ReleaseTrack())

        cluster_ref = args.CONCEPTS.cluster.Parse()

        request = dataproc.messages.DataprocProjectsRegionsClustersGetRequest(
            projectId=cluster_ref.projectId,
            region=cluster_ref.region,
            clusterName=cluster_ref.clusterName)

        cluster = dataproc.client.projects_regions_clusters.Get(request)

        # Filter out Dataproc-generated labels and properties.
        clusters.DeleteGeneratedLabels(cluster, dataproc)
        clusters.DeleteGeneratedProperties(cluster, dataproc)

        RemoveNonImportableFields(cluster)
        if args.destination:
            with files.FileWriter(args.destination) as stream:
                export_util.Export(message=cluster, stream=stream)
        else:
            export_util.Export(message=cluster, stream=sys.stdout)
Esempio n. 3
0
    def Run(self, args):
        dataproc = dp.Dataproc(self.ReleaseTrack())

        cluster_ref = util.ParseCluster(args.name, dataproc)

        request = dataproc.messages.DataprocProjectsRegionsClustersGetRequest(
            projectId=cluster_ref.projectId,
            region=cluster_ref.region,
            clusterName=cluster_ref.clusterName)

        cluster = dataproc.client.projects_regions_clusters.Get(request)

        # Filter out Dataproc-generated labels.
        clusters.DeleteGeneratedLabels(cluster, dataproc)

        if args.destination:
            with files.FileWriter(args.destination) as stream:
                util.WriteYaml(message=cluster,
                               stream=stream,
                               schema_path=SCHEMA_PATH)
        else:
            util.WriteYaml(message=cluster,
                           stream=sys.stdout,
                           schema_path=SCHEMA_PATH)