Skip to content
This repository has been archived by the owner on Oct 16, 2023. It is now read-only.

Commit

Permalink
feat: Add task details and orchestration result details (#32)
Browse files Browse the repository at this point in the history
* feat!: Consolidate task details into service API and add orchestration result details BREAKING CHANGE: This change relocates some task proto definitions and updates message fields, necessitating updates to imports.

PiperOrigin-RevId: 423360094

Source-Link: googleapis/googleapis@c9a482e

Source-Link: googleapis/googleapis-gen@0c2ce73
Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiMGMyY2U3M2MxNDgzODllNDM4MmMxMWViN2FiZmQwYjI2OTczY2JiNyJ9

* 🦉 Updates from OwlBot

See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md

Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com>
Co-authored-by: Anthonios Partheniou <[email protected]>
  • Loading branch information
3 people authored Jan 24, 2022
1 parent 2ec1240 commit 44c10e1
Show file tree
Hide file tree
Showing 7 changed files with 455 additions and 4 deletions.
36 changes: 36 additions & 0 deletions google/cloud/bigquery_migration/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,21 @@
MigrationServiceAsyncClient,
)

from google.cloud.bigquery_migration_v2alpha.types.assessment_task import (
AssessmentOrchestrationResultDetails,
)
from google.cloud.bigquery_migration_v2alpha.types.assessment_task import (
AssessmentTaskDetails,
)
from google.cloud.bigquery_migration_v2alpha.types.migration_entities import (
MigrationSubtask,
)
from google.cloud.bigquery_migration_v2alpha.types.migration_entities import (
MigrationTask,
)
from google.cloud.bigquery_migration_v2alpha.types.migration_entities import (
MigrationTaskOrchestrationResult,
)
from google.cloud.bigquery_migration_v2alpha.types.migration_entities import (
MigrationWorkflow,
)
Expand Down Expand Up @@ -70,12 +79,32 @@
from google.cloud.bigquery_migration_v2alpha.types.migration_service import (
StartMigrationWorkflowRequest,
)
from google.cloud.bigquery_migration_v2alpha.types.translation_task import BteqOptions
from google.cloud.bigquery_migration_v2alpha.types.translation_task import (
DatasetReference,
)
from google.cloud.bigquery_migration_v2alpha.types.translation_task import Filter
from google.cloud.bigquery_migration_v2alpha.types.translation_task import (
IdentifierSettings,
)
from google.cloud.bigquery_migration_v2alpha.types.translation_task import (
TeradataOptions,
)
from google.cloud.bigquery_migration_v2alpha.types.translation_task import (
TranslationFileMapping,
)
from google.cloud.bigquery_migration_v2alpha.types.translation_task import (
TranslationTaskDetails,
)

__all__ = (
"MigrationServiceClient",
"MigrationServiceAsyncClient",
"AssessmentOrchestrationResultDetails",
"AssessmentTaskDetails",
"MigrationSubtask",
"MigrationTask",
"MigrationTaskOrchestrationResult",
"MigrationWorkflow",
"ErrorDetail",
"ErrorLocation",
Expand All @@ -93,4 +122,11 @@
"ListMigrationWorkflowsRequest",
"ListMigrationWorkflowsResponse",
"StartMigrationWorkflowRequest",
"BteqOptions",
"DatasetReference",
"Filter",
"IdentifierSettings",
"TeradataOptions",
"TranslationFileMapping",
"TranslationTaskDetails",
)
20 changes: 20 additions & 0 deletions google/cloud/bigquery_migration_v2alpha/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,11 @@
from .services.migration_service import MigrationServiceClient
from .services.migration_service import MigrationServiceAsyncClient

from .types.assessment_task import AssessmentOrchestrationResultDetails
from .types.assessment_task import AssessmentTaskDetails
from .types.migration_entities import MigrationSubtask
from .types.migration_entities import MigrationTask
from .types.migration_entities import MigrationTaskOrchestrationResult
from .types.migration_entities import MigrationWorkflow
from .types.migration_error_details import ErrorDetail
from .types.migration_error_details import ErrorLocation
Expand All @@ -36,27 +39,44 @@
from .types.migration_service import ListMigrationWorkflowsRequest
from .types.migration_service import ListMigrationWorkflowsResponse
from .types.migration_service import StartMigrationWorkflowRequest
from .types.translation_task import BteqOptions
from .types.translation_task import DatasetReference
from .types.translation_task import Filter
from .types.translation_task import IdentifierSettings
from .types.translation_task import TeradataOptions
from .types.translation_task import TranslationFileMapping
from .types.translation_task import TranslationTaskDetails

__all__ = (
"MigrationServiceAsyncClient",
"AssessmentOrchestrationResultDetails",
"AssessmentTaskDetails",
"BteqOptions",
"CreateMigrationWorkflowRequest",
"DatasetReference",
"DeleteMigrationWorkflowRequest",
"ErrorDetail",
"ErrorLocation",
"Filter",
"GetMigrationSubtaskRequest",
"GetMigrationWorkflowRequest",
"IdentifierSettings",
"ListMigrationSubtasksRequest",
"ListMigrationSubtasksResponse",
"ListMigrationWorkflowsRequest",
"ListMigrationWorkflowsResponse",
"MigrationServiceClient",
"MigrationSubtask",
"MigrationTask",
"MigrationTaskOrchestrationResult",
"MigrationWorkflow",
"Point",
"ResourceErrorDetail",
"StartMigrationWorkflowRequest",
"TeradataOptions",
"TimeInterval",
"TimeSeries",
"TranslationFileMapping",
"TranslationTaskDetails",
"TypedValue",
)
24 changes: 24 additions & 0 deletions google/cloud/bigquery_migration_v2alpha/types/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,14 @@
# See the License for the specific language governing permissions and
# limitations under the License.
#
from .assessment_task import (
AssessmentOrchestrationResultDetails,
AssessmentTaskDetails,
)
from .migration_entities import (
MigrationSubtask,
MigrationTask,
MigrationTaskOrchestrationResult,
MigrationWorkflow,
)
from .migration_error_details import (
Expand All @@ -40,10 +45,22 @@
ListMigrationWorkflowsResponse,
StartMigrationWorkflowRequest,
)
from .translation_task import (
BteqOptions,
DatasetReference,
Filter,
IdentifierSettings,
TeradataOptions,
TranslationFileMapping,
TranslationTaskDetails,
)

__all__ = (
"AssessmentOrchestrationResultDetails",
"AssessmentTaskDetails",
"MigrationSubtask",
"MigrationTask",
"MigrationTaskOrchestrationResult",
"MigrationWorkflow",
"ErrorDetail",
"ErrorLocation",
Expand All @@ -61,4 +78,11 @@
"ListMigrationWorkflowsRequest",
"ListMigrationWorkflowsResponse",
"StartMigrationWorkflowRequest",
"BteqOptions",
"DatasetReference",
"Filter",
"IdentifierSettings",
"TeradataOptions",
"TranslationFileMapping",
"TranslationTaskDetails",
)
62 changes: 62 additions & 0 deletions google/cloud/bigquery_migration_v2alpha/types/assessment_task.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
# -*- coding: utf-8 -*-
# Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
import proto # type: ignore


__protobuf__ = proto.module(
package="google.cloud.bigquery.migration.v2alpha",
manifest={"AssessmentTaskDetails", "AssessmentOrchestrationResultDetails",},
)


class AssessmentTaskDetails(proto.Message):
r"""Assessment task config.
Attributes:
input_path (str):
Required. The Cloud Storage path for
assessment input files.
output_dataset (str):
Required. The BigQuery dataset for output.
querylogs_path (str):
Optional. An optional Cloud Storage path to
write the query logs (which is then used as an
input path on the translation task)
data_source (str):
Required. The data source or data warehouse
type (eg: TERADATA/REDSHIFT) from which the
input data is extracted.
"""

input_path = proto.Field(proto.STRING, number=1,)
output_dataset = proto.Field(proto.STRING, number=2,)
querylogs_path = proto.Field(proto.STRING, number=3,)
data_source = proto.Field(proto.STRING, number=4,)


class AssessmentOrchestrationResultDetails(proto.Message):
r"""Details for an assessment task orchestration result.
Attributes:
output_tables_schema_version (str):
Optional. The version used for the output
table schemas.
"""

output_tables_schema_version = proto.Field(proto.STRING, number=1,)


__all__ = tuple(sorted(__protobuf__.manifest))
Original file line number Diff line number Diff line change
Expand Up @@ -15,16 +15,23 @@
#
import proto # type: ignore

from google.cloud.bigquery_migration_v2alpha.types import assessment_task
from google.cloud.bigquery_migration_v2alpha.types import migration_error_details
from google.cloud.bigquery_migration_v2alpha.types import migration_metrics
from google.cloud.bigquery_migration_v2alpha.types import translation_task
from google.protobuf import any_pb2 # type: ignore
from google.protobuf import timestamp_pb2 # type: ignore
from google.rpc import error_details_pb2 # type: ignore


__protobuf__ = proto.module(
package="google.cloud.bigquery.migration.v2alpha",
manifest={"MigrationWorkflow", "MigrationTask", "MigrationSubtask",},
manifest={
"MigrationWorkflow",
"MigrationTask",
"MigrationSubtask",
"MigrationTaskOrchestrationResult",
},
)


Expand Down Expand Up @@ -79,7 +86,23 @@ class MigrationTask(proto.Message):
r"""A single task for a migration which has details about the
configuration of the task.
This message has `oneof`_ fields (mutually exclusive fields).
For each oneof, at most one member field can be set at the same time.
Setting any member of the oneof automatically clears all other
members.
.. _oneof: https://proto-plus-python.readthedocs.io/en/stable/fields.html#oneofs-mutually-exclusive-fields
Attributes:
assessment_task_details (google.cloud.bigquery_migration_v2alpha.types.AssessmentTaskDetails):
Task configuration for Assessment.
This field is a member of `oneof`_ ``task_details``.
translation_task_details (google.cloud.bigquery_migration_v2alpha.types.TranslationTaskDetails):
Task configuration for Batch/Offline SQL
Translation.
This field is a member of `oneof`_ ``task_details``.
id (str):
Output only. Immutable. The unique identifier
for the migration task. The ID is server-
Expand All @@ -88,9 +111,9 @@ class MigrationTask(proto.Message):
The type of the task. This must be a
supported task type.
details (google.protobuf.any_pb2.Any):
The details of the task. The type URL must be
one of the supported task details messages and
correspond to the Task's type.
DEPRECATED! Use one of the task_details below. The details
of the task. The type URL must be one of the supported task
details messages and correspond to the Task's type.
state (google.cloud.bigquery_migration_v2alpha.types.MigrationTask.State):
Output only. The current state of the task.
processing_error (google.rpc.error_details_pb2.ErrorInfo):
Expand All @@ -100,6 +123,9 @@ class MigrationTask(proto.Message):
Time when the task was created.
last_update_time (google.protobuf.timestamp_pb2.Timestamp):
Time when the task was last updated.
orchestration_result (google.cloud.bigquery_migration_v2alpha.types.MigrationTaskOrchestrationResult):
Output only. Additional information about the
orchestration.
"""

class State(proto.Enum):
Expand All @@ -112,6 +138,18 @@ class State(proto.Enum):
SUCCEEDED = 5
FAILED = 6

assessment_task_details = proto.Field(
proto.MESSAGE,
number=12,
oneof="task_details",
message=assessment_task.AssessmentTaskDetails,
)
translation_task_details = proto.Field(
proto.MESSAGE,
number=13,
oneof="task_details",
message=translation_task.TranslationTaskDetails,
)
id = proto.Field(proto.STRING, number=1,)
type_ = proto.Field(proto.STRING, number=2,)
details = proto.Field(proto.MESSAGE, number=3, message=any_pb2.Any,)
Expand All @@ -123,6 +161,9 @@ class State(proto.Enum):
last_update_time = proto.Field(
proto.MESSAGE, number=7, message=timestamp_pb2.Timestamp,
)
orchestration_result = proto.Field(
proto.MESSAGE, number=10, message="MigrationTaskOrchestrationResult",
)


class MigrationSubtask(proto.Message):
Expand Down Expand Up @@ -202,4 +243,26 @@ class State(proto.Enum):
)


class MigrationTaskOrchestrationResult(proto.Message):
r"""Additional information from the orchestrator when it is done
with the task orchestration.
.. _oneof: https://proto-plus-python.readthedocs.io/en/stable/fields.html#oneofs-mutually-exclusive-fields
Attributes:
assessment_details (google.cloud.bigquery_migration_v2alpha.types.AssessmentOrchestrationResultDetails):
Details specific to assessment task types.
This field is a member of `oneof`_ ``details``.
"""

assessment_details = proto.Field(
proto.MESSAGE,
number=1,
oneof="details",
message=assessment_task.AssessmentOrchestrationResultDetails,
)


__all__ = tuple(sorted(__protobuf__.manifest))
Loading

0 comments on commit 44c10e1

Please sign in to comment.