another-ayx-python-sdk 2.4.23__py3-none-any.whl → 2.4.24__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- another_ayx_python_sdk/version.py +3 -3
- {another_ayx_python_sdk-2.4.23.dist-info → another_ayx_python_sdk-2.4.24.dist-info}/METADATA +2 -2
- {another_ayx_python_sdk-2.4.23.dist-info → another_ayx_python_sdk-2.4.24.dist-info}/RECORD +212 -7
- {another_ayx_python_sdk-2.4.23.dist-info → another_ayx_python_sdk-2.4.24.dist-info}/top_level.txt +2 -0
- build/lib/another_ayx_python_sdk/__init__.py +14 -0
- build/lib/another_ayx_python_sdk/__main__.py +470 -0
- build/lib/another_ayx_python_sdk/assets/workspace_files/__init__.py +14 -0
- build/lib/another_ayx_python_sdk/assets/workspace_files/setup.py +38 -0
- build/lib/another_ayx_python_sdk/cli/__init__.py +14 -0
- build/lib/another_ayx_python_sdk/cli/utilities.py +103 -0
- build/lib/another_ayx_python_sdk/cli/workspace.py +266 -0
- build/lib/another_ayx_python_sdk/cli/yxi_builder.py +125 -0
- build/lib/another_ayx_python_sdk/cli/yxi_installer.py +45 -0
- build/lib/another_ayx_python_sdk/core/__init__.py +51 -0
- build/lib/another_ayx_python_sdk/core/constants.py +25 -0
- build/lib/another_ayx_python_sdk/core/dcm_base.py +115 -0
- build/lib/another_ayx_python_sdk/core/doc_utilities.py +40 -0
- build/lib/another_ayx_python_sdk/core/environment_base.py +213 -0
- build/lib/another_ayx_python_sdk/core/exceptions.py +59 -0
- build/lib/another_ayx_python_sdk/core/field.py +183 -0
- build/lib/another_ayx_python_sdk/core/input_anchor_base.py +86 -0
- build/lib/another_ayx_python_sdk/core/input_connection_base.py +206 -0
- build/lib/another_ayx_python_sdk/core/io_base.py +139 -0
- build/lib/another_ayx_python_sdk/core/metadata.py +173 -0
- build/lib/another_ayx_python_sdk/core/observable_mixin.py +90 -0
- build/lib/another_ayx_python_sdk/core/output_anchor_base.py +151 -0
- build/lib/another_ayx_python_sdk/core/plugin.py +108 -0
- build/lib/another_ayx_python_sdk/core/plugin_v2.py +97 -0
- build/lib/another_ayx_python_sdk/core/provider_base.py +125 -0
- build/lib/another_ayx_python_sdk/core/proxy_requests.py +51 -0
- build/lib/another_ayx_python_sdk/core/record_packet.py +88 -0
- build/lib/another_ayx_python_sdk/core/record_packet_base.py +123 -0
- build/lib/another_ayx_python_sdk/core/register_plugin.py +127 -0
- build/lib/another_ayx_python_sdk/core/testing.py +191 -0
- build/lib/another_ayx_python_sdk/core/utils.py +146 -0
- build/lib/another_ayx_python_sdk/examples/AyxSdkInput/main.py +89 -0
- build/lib/another_ayx_python_sdk/examples/AyxSdkMultiConnectionsMultiOutputAnchor/main.py +102 -0
- build/lib/another_ayx_python_sdk/examples/AyxSdkMultipleInputAnchors/main.py +84 -0
- build/lib/another_ayx_python_sdk/examples/AyxSdkMultipleOutputAnchors/main.py +96 -0
- build/lib/another_ayx_python_sdk/examples/AyxSdkOptionalInputAnchor/main.py +94 -0
- build/lib/another_ayx_python_sdk/examples/AyxSdkOutput/main.py +78 -0
- build/lib/another_ayx_python_sdk/examples/AyxSdkPassThrough/main.py +82 -0
- build/lib/another_ayx_python_sdk/providers/__init__.py +14 -0
- build/lib/another_ayx_python_sdk/providers/amp_provider/__init__.py +41 -0
- build/lib/another_ayx_python_sdk/providers/amp_provider/__main__.py +85 -0
- build/lib/another_ayx_python_sdk/providers/amp_provider/amp_dcm.py +58 -0
- build/lib/another_ayx_python_sdk/providers/amp_provider/amp_driver.py +358 -0
- build/lib/another_ayx_python_sdk/providers/amp_provider/amp_environment.py +73 -0
- build/lib/another_ayx_python_sdk/providers/amp_provider/amp_environment_v2.py +278 -0
- build/lib/another_ayx_python_sdk/providers/amp_provider/amp_input_anchor.py +73 -0
- build/lib/another_ayx_python_sdk/providers/amp_provider/amp_input_connection.py +132 -0
- build/lib/another_ayx_python_sdk/providers/amp_provider/amp_io.py +64 -0
- build/lib/another_ayx_python_sdk/providers/amp_provider/amp_io_components.py +407 -0
- build/lib/another_ayx_python_sdk/providers/amp_provider/amp_output_anchor.py +107 -0
- build/lib/another_ayx_python_sdk/providers/amp_provider/amp_provider.py +68 -0
- build/lib/another_ayx_python_sdk/providers/amp_provider/amp_provider_v2.py +128 -0
- build/lib/another_ayx_python_sdk/providers/amp_provider/amp_record_packet.py +21 -0
- build/lib/another_ayx_python_sdk/providers/amp_provider/builders/__init__.py +32 -0
- build/lib/another_ayx_python_sdk/providers/amp_provider/builders/input_anchor_builder.py +123 -0
- build/lib/another_ayx_python_sdk/providers/amp_provider/builders/input_connection_builder.py +95 -0
- build/lib/another_ayx_python_sdk/providers/amp_provider/builders/metadata_builder.py +118 -0
- build/lib/another_ayx_python_sdk/providers/amp_provider/builders/output_anchor_builder.py +110 -0
- build/lib/another_ayx_python_sdk/providers/amp_provider/builders/packers.py +458 -0
- build/lib/another_ayx_python_sdk/providers/amp_provider/builders/record_builder.py +204 -0
- build/lib/another_ayx_python_sdk/providers/amp_provider/builders/record_packet_builder.py +133 -0
- build/lib/another_ayx_python_sdk/providers/amp_provider/builders/tool_config_builder.py +59 -0
- build/lib/another_ayx_python_sdk/providers/amp_provider/cng_certs.py +197 -0
- build/lib/another_ayx_python_sdk/providers/amp_provider/data_transport/__init__.py +18 -0
- build/lib/another_ayx_python_sdk/providers/amp_provider/data_transport/amp_transport.py +127 -0
- build/lib/another_ayx_python_sdk/providers/amp_provider/data_transport/transport_base.py +35 -0
- build/lib/another_ayx_python_sdk/providers/amp_provider/grpc_helpers/__init__.py +14 -0
- build/lib/another_ayx_python_sdk/providers/amp_provider/grpc_helpers/control_msgs.py +189 -0
- build/lib/another_ayx_python_sdk/providers/amp_provider/grpc_helpers/dcme_msgs.py +119 -0
- build/lib/another_ayx_python_sdk/providers/amp_provider/grpc_helpers/record_transfer_msgs.py +32 -0
- build/lib/another_ayx_python_sdk/providers/amp_provider/grpc_util.py +161 -0
- build/lib/another_ayx_python_sdk/providers/amp_provider/logger_config.py +63 -0
- build/lib/another_ayx_python_sdk/providers/amp_provider/plugin_class_loader.py +77 -0
- build/lib/another_ayx_python_sdk/providers/amp_provider/repositories/__init__.py +67 -0
- build/lib/another_ayx_python_sdk/providers/amp_provider/repositories/dcm_repository.py +252 -0
- build/lib/another_ayx_python_sdk/providers/amp_provider/repositories/environment_repository.py +212 -0
- build/lib/another_ayx_python_sdk/providers/amp_provider/repositories/grpc_repository.py +119 -0
- build/lib/another_ayx_python_sdk/providers/amp_provider/repositories/input_anchor_repository.py +110 -0
- build/lib/another_ayx_python_sdk/providers/amp_provider/repositories/input_connection_repository.py +276 -0
- build/lib/another_ayx_python_sdk/providers/amp_provider/repositories/input_metadata_repository.py +144 -0
- build/lib/another_ayx_python_sdk/providers/amp_provider/repositories/input_record_packet_repository.py +252 -0
- build/lib/another_ayx_python_sdk/providers/amp_provider/repositories/io_repository.py +188 -0
- build/lib/another_ayx_python_sdk/providers/amp_provider/repositories/output_anchor_repository.py +117 -0
- build/lib/another_ayx_python_sdk/providers/amp_provider/repositories/output_metadata_repository.py +129 -0
- build/lib/another_ayx_python_sdk/providers/amp_provider/repositories/output_record_packet_repository.py +170 -0
- build/lib/another_ayx_python_sdk/providers/amp_provider/repositories/plugin_class_repository.py +55 -0
- build/lib/another_ayx_python_sdk/providers/amp_provider/repositories/singleton.py +32 -0
- build/lib/another_ayx_python_sdk/providers/amp_provider/repositories/test_harness_state_repository.py +172 -0
- build/lib/another_ayx_python_sdk/providers/amp_provider/repositories/tool_config_repository.py +89 -0
- build/lib/another_ayx_python_sdk/providers/amp_provider/resources/__init__.py +14 -0
- build/lib/another_ayx_python_sdk/providers/amp_provider/resources/generated/__init__.py +0 -0
- build/lib/another_ayx_python_sdk/providers/amp_provider/resources/generated/close_outgoing_anchor_pb2.py +25 -0
- build/lib/another_ayx_python_sdk/providers/amp_provider/resources/generated/close_outgoing_anchor_pb2_grpc.py +4 -0
- build/lib/another_ayx_python_sdk/providers/amp_provider/resources/generated/dcm_e_pb2.py +38 -0
- build/lib/another_ayx_python_sdk/providers/amp_provider/resources/generated/dcm_e_pb2_grpc.py +4 -0
- build/lib/another_ayx_python_sdk/providers/amp_provider/resources/generated/incoming_anchor_pb2.py +26 -0
- build/lib/another_ayx_python_sdk/providers/amp_provider/resources/generated/incoming_anchor_pb2_grpc.py +4 -0
- build/lib/another_ayx_python_sdk/providers/amp_provider/resources/generated/incoming_connection_complete_pb2.py +25 -0
- build/lib/another_ayx_python_sdk/providers/amp_provider/resources/generated/incoming_connection_complete_pb2_grpc.py +4 -0
- build/lib/another_ayx_python_sdk/providers/amp_provider/resources/generated/incoming_connection_pb2.py +26 -0
- build/lib/another_ayx_python_sdk/providers/amp_provider/resources/generated/incoming_connection_pb2_grpc.py +4 -0
- build/lib/another_ayx_python_sdk/providers/amp_provider/resources/generated/incoming_data_push_pb2.py +26 -0
- build/lib/another_ayx_python_sdk/providers/amp_provider/resources/generated/incoming_data_push_pb2_grpc.py +4 -0
- build/lib/another_ayx_python_sdk/providers/amp_provider/resources/generated/incoming_record_packet_push_pb2.py +26 -0
- build/lib/another_ayx_python_sdk/providers/amp_provider/resources/generated/incoming_record_packet_push_pb2_grpc.py +4 -0
- build/lib/another_ayx_python_sdk/providers/amp_provider/resources/generated/metadata_pb2.py +31 -0
- build/lib/another_ayx_python_sdk/providers/amp_provider/resources/generated/metadata_pb2_grpc.py +4 -0
- build/lib/another_ayx_python_sdk/providers/amp_provider/resources/generated/outgoing_anchor_pb2.py +28 -0
- build/lib/another_ayx_python_sdk/providers/amp_provider/resources/generated/outgoing_anchor_pb2_grpc.py +4 -0
- build/lib/another_ayx_python_sdk/providers/amp_provider/resources/generated/outgoing_data_push_pb2.py +26 -0
- build/lib/another_ayx_python_sdk/providers/amp_provider/resources/generated/outgoing_data_push_pb2_grpc.py +4 -0
- build/lib/another_ayx_python_sdk/providers/amp_provider/resources/generated/outgoing_metadata_push_pb2.py +26 -0
- build/lib/another_ayx_python_sdk/providers/amp_provider/resources/generated/outgoing_metadata_push_pb2_grpc.py +4 -0
- build/lib/another_ayx_python_sdk/providers/amp_provider/resources/generated/outgoing_record_packet_push_pb2.py +26 -0
- build/lib/another_ayx_python_sdk/providers/amp_provider/resources/generated/outgoing_record_packet_push_pb2_grpc.py +4 -0
- build/lib/another_ayx_python_sdk/providers/amp_provider/resources/generated/output_message_data_pb2.py +29 -0
- build/lib/another_ayx_python_sdk/providers/amp_provider/resources/generated/output_message_data_pb2_grpc.py +4 -0
- build/lib/another_ayx_python_sdk/providers/amp_provider/resources/generated/password_data_pb2.py +25 -0
- build/lib/another_ayx_python_sdk/providers/amp_provider/resources/generated/password_data_pb2_grpc.py +4 -0
- build/lib/another_ayx_python_sdk/providers/amp_provider/resources/generated/plugin_initialization_data_pb2.py +33 -0
- build/lib/another_ayx_python_sdk/providers/amp_provider/resources/generated/plugin_initialization_data_pb2_grpc.py +4 -0
- build/lib/another_ayx_python_sdk/providers/amp_provider/resources/generated/record_batch_pb2.py +25 -0
- build/lib/another_ayx_python_sdk/providers/amp_provider/resources/generated/record_batch_pb2_grpc.py +4 -0
- build/lib/another_ayx_python_sdk/providers/amp_provider/resources/generated/record_packet_pb2.py +29 -0
- build/lib/another_ayx_python_sdk/providers/amp_provider/resources/generated/record_packet_pb2_grpc.py +4 -0
- build/lib/another_ayx_python_sdk/providers/amp_provider/resources/generated/sdk_engine_service_pb2.py +34 -0
- build/lib/another_ayx_python_sdk/providers/amp_provider/resources/generated/sdk_engine_service_pb2_grpc.py +305 -0
- build/lib/another_ayx_python_sdk/providers/amp_provider/resources/generated/sdk_tool_service_pb2.py +30 -0
- build/lib/another_ayx_python_sdk/providers/amp_provider/resources/generated/sdk_tool_service_pb2_grpc.py +235 -0
- build/lib/another_ayx_python_sdk/providers/amp_provider/resources/generated/sdk_tool_service_startup_info_pb2.py +25 -0
- build/lib/another_ayx_python_sdk/providers/amp_provider/resources/generated/sdk_tool_service_startup_info_pb2_grpc.py +4 -0
- build/lib/another_ayx_python_sdk/providers/amp_provider/resources/generated/sdk_tool_service_v2_pb2.py +54 -0
- build/lib/another_ayx_python_sdk/providers/amp_provider/resources/generated/sdk_tool_service_v2_pb2_grpc.py +99 -0
- build/lib/another_ayx_python_sdk/providers/amp_provider/resources/generated/translate_message_data_pb2.py +27 -0
- build/lib/another_ayx_python_sdk/providers/amp_provider/resources/generated/translate_message_data_pb2_grpc.py +4 -0
- build/lib/another_ayx_python_sdk/providers/amp_provider/resources/generated/transport_pb2.py +31 -0
- build/lib/another_ayx_python_sdk/providers/amp_provider/resources/generated/transport_pb2_grpc.py +4 -0
- build/lib/another_ayx_python_sdk/providers/amp_provider/resources/generated/update_progress_pb2.py +25 -0
- build/lib/another_ayx_python_sdk/providers/amp_provider/resources/generated/update_progress_pb2_grpc.py +4 -0
- build/lib/another_ayx_python_sdk/providers/amp_provider/sdk_tool_runner.py +115 -0
- build/lib/another_ayx_python_sdk/providers/amp_provider/sdk_tool_service.py +207 -0
- build/lib/another_ayx_python_sdk/providers/amp_provider/sdk_tool_service_v2.py +306 -0
- build/lib/another_ayx_python_sdk/providers/amp_provider/utilities/__init__.py +14 -0
- build/lib/another_ayx_python_sdk/providers/amp_provider/utilities/constants.py +22 -0
- build/lib/another_ayx_python_sdk/providers/amp_provider/utilities/conversions.py +55 -0
- build/lib/another_ayx_python_sdk/providers/amp_provider/utilities/utilities.py +63 -0
- build/lib/another_ayx_python_sdk/providers/e1_provider/__init__.py +36 -0
- build/lib/another_ayx_python_sdk/providers/e1_provider/anchor_builder.py +95 -0
- build/lib/another_ayx_python_sdk/providers/e1_provider/cache_e1_sdk_import.py +31 -0
- build/lib/another_ayx_python_sdk/providers/e1_provider/connection_callback_strategy.py +155 -0
- build/lib/another_ayx_python_sdk/providers/e1_provider/connection_interface.py +125 -0
- build/lib/another_ayx_python_sdk/providers/e1_provider/e1_dcm.py +53 -0
- build/lib/another_ayx_python_sdk/providers/e1_provider/e1_environment.py +127 -0
- build/lib/another_ayx_python_sdk/providers/e1_provider/e1_input_anchor.py +51 -0
- build/lib/another_ayx_python_sdk/providers/e1_provider/e1_input_anchor_proxy.py +33 -0
- build/lib/another_ayx_python_sdk/providers/e1_provider/e1_input_connection.py +87 -0
- build/lib/another_ayx_python_sdk/providers/e1_provider/e1_io.py +71 -0
- build/lib/another_ayx_python_sdk/providers/e1_provider/e1_output_anchor.py +157 -0
- build/lib/another_ayx_python_sdk/providers/e1_provider/e1_output_anchor_proxy.py +97 -0
- build/lib/another_ayx_python_sdk/providers/e1_provider/e1_plugin_driver.py +63 -0
- build/lib/another_ayx_python_sdk/providers/e1_provider/e1_plugin_proxy.py +363 -0
- build/lib/another_ayx_python_sdk/providers/e1_provider/e1_provider.py +71 -0
- build/lib/another_ayx_python_sdk/providers/e1_provider/e1_record_packet.py +21 -0
- build/lib/another_ayx_python_sdk/providers/e1_provider/events.py +36 -0
- build/lib/another_ayx_python_sdk/providers/e1_provider/mock_e1_sdk/AlteryxPythonSDK/__init__.py +37 -0
- build/lib/another_ayx_python_sdk/providers/e1_provider/mock_e1_sdk/AlteryxPythonSDK/alteryx_engine.py +105 -0
- build/lib/another_ayx_python_sdk/providers/e1_provider/mock_e1_sdk/AlteryxPythonSDK/constants.py +50 -0
- build/lib/another_ayx_python_sdk/providers/e1_provider/mock_e1_sdk/AlteryxPythonSDK/field.py +122 -0
- build/lib/another_ayx_python_sdk/providers/e1_provider/mock_e1_sdk/AlteryxPythonSDK/output_anchor.py +55 -0
- build/lib/another_ayx_python_sdk/providers/e1_provider/mock_e1_sdk/AlteryxPythonSDK/output_anchor_manager.py +31 -0
- build/lib/another_ayx_python_sdk/providers/e1_provider/mock_e1_sdk/AlteryxPythonSDK/record_copier.py +65 -0
- build/lib/another_ayx_python_sdk/providers/e1_provider/mock_e1_sdk/AlteryxPythonSDK/record_creator.py +41 -0
- build/lib/another_ayx_python_sdk/providers/e1_provider/mock_e1_sdk/AlteryxPythonSDK/record_info.py +134 -0
- build/lib/another_ayx_python_sdk/providers/e1_provider/mock_e1_sdk/AlteryxPythonSDK/record_ref.py +42 -0
- build/lib/another_ayx_python_sdk/providers/e1_provider/mock_e1_sdk/AlteryxPythonSDK/tool.py +29 -0
- build/lib/another_ayx_python_sdk/providers/e1_provider/mock_e1_sdk/AlteryxPythonSDK/tool_execution_info.py +43 -0
- build/lib/another_ayx_python_sdk/providers/e1_provider/mock_e1_sdk/__init__.py +14 -0
- build/lib/another_ayx_python_sdk/providers/e1_provider/proxies/__init__.py +18 -0
- build/lib/another_ayx_python_sdk/providers/e1_provider/proxies/field_proxy.py +109 -0
- build/lib/another_ayx_python_sdk/providers/e1_provider/proxies/record_copier_proxy.py +49 -0
- build/lib/another_ayx_python_sdk/providers/e1_provider/records/__init__.py +23 -0
- build/lib/another_ayx_python_sdk/providers/e1_provider/records/base_record_container.py +47 -0
- build/lib/another_ayx_python_sdk/providers/e1_provider/records/parsed_record_container.py +67 -0
- build/lib/another_ayx_python_sdk/providers/e1_provider/records/raw_record_container.py +111 -0
- build/lib/another_ayx_python_sdk/providers/e1_provider/tool_config_loader.py +132 -0
- build/lib/another_ayx_python_sdk/providers/e1_provider/utilities/__init__.py +35 -0
- build/lib/another_ayx_python_sdk/providers/e1_provider/utilities/utilities.py +54 -0
- build/lib/another_ayx_python_sdk/providers/e1_provider/workflow_config.py +31 -0
- build/lib/another_ayx_python_sdk/providers/file_provider/__init__.py +32 -0
- build/lib/another_ayx_python_sdk/providers/file_provider/environment.py +131 -0
- build/lib/another_ayx_python_sdk/providers/file_provider/file_adapter.py +286 -0
- build/lib/another_ayx_python_sdk/providers/file_provider/file_provider.py +185 -0
- build/lib/another_ayx_python_sdk/providers/file_provider/file_provider_dcm.py +53 -0
- build/lib/another_ayx_python_sdk/providers/file_provider/file_provider_input_anchor.py +70 -0
- build/lib/another_ayx_python_sdk/providers/file_provider/file_provider_input_connection.py +112 -0
- build/lib/another_ayx_python_sdk/providers/file_provider/file_provider_output_anchor.py +114 -0
- build/lib/another_ayx_python_sdk/providers/file_provider/file_record_packet.py +21 -0
- build/lib/another_ayx_python_sdk/providers/file_provider/iox.py +56 -0
- build/lib/another_ayx_python_sdk/providers/file_provider/tool_input.py +104 -0
- build/lib/another_ayx_python_sdk/test_harness/__init__.py +14 -0
- build/lib/another_ayx_python_sdk/test_harness/__main__.py +120 -0
- build/lib/another_ayx_python_sdk/test_harness/plugin_runner.py +416 -0
- build/lib/another_ayx_python_sdk/test_harness/process_lifecycle_manager.py +80 -0
- build/lib/another_ayx_python_sdk/test_harness/sdk_engine_service.py +106 -0
- build/lib/another_ayx_python_sdk/version.py +8 -0
- {another_ayx_python_sdk-2.4.23.dist-info → another_ayx_python_sdk-2.4.24.dist-info}/WHEEL +0 -0
- {another_ayx_python_sdk-2.4.23.dist-info → another_ayx_python_sdk-2.4.24.dist-info}/entry_points.txt +0 -0
- {another_ayx_python_sdk-2.4.23.dist-info → another_ayx_python_sdk-2.4.24.dist-info}/licenses/LICENSE +0 -0
@@ -0,0 +1,407 @@
|
|
1
|
+
# Copyright (C) 2022 Alteryx, Inc. All rights reserved.
|
2
|
+
#
|
3
|
+
# Licensed under the ALTERYX SDK AND API LICENSE AGREEMENT;
|
4
|
+
# you may not use this file except in compliance with the License.
|
5
|
+
# You may obtain a copy of the License at
|
6
|
+
#
|
7
|
+
# https://www.alteryx.com/alteryx-sdk-and-api-license-agreement
|
8
|
+
#
|
9
|
+
# Unless required by applicable law or agreed to in writing, software
|
10
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
11
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
12
|
+
# See the License for the specific language governing permissions and
|
13
|
+
# limitations under the License.
|
14
|
+
"""AMP Provider: Proxy class for SDK IO (input/output)."""
|
15
|
+
import asyncio
|
16
|
+
import logging
|
17
|
+
import time
|
18
|
+
from asyncio.queues import QueueEmpty
|
19
|
+
from collections import namedtuple
|
20
|
+
from typing import Any, Callable, Dict, Optional, TYPE_CHECKING
|
21
|
+
|
22
|
+
import another_ayx_python_sdk.providers.amp_provider.grpc_helpers.control_msgs as ctrl_msg
|
23
|
+
import another_ayx_python_sdk.providers.amp_provider.grpc_helpers.dcme_msgs as dcm_msg
|
24
|
+
from another_ayx_python_sdk.core.exceptions import DcmEException
|
25
|
+
from another_ayx_python_sdk.providers.amp_provider.data_transport.amp_transport import (
|
26
|
+
AmpStreamTransport,
|
27
|
+
)
|
28
|
+
from another_ayx_python_sdk.providers.amp_provider.resources.generated.output_message_data_pb2 import (
|
29
|
+
OutputMessagePriorityFlags,
|
30
|
+
)
|
31
|
+
from another_ayx_python_sdk.providers.amp_provider.resources.generated.sdk_tool_service_v2_pb2 import (
|
32
|
+
RecordTransferOut,
|
33
|
+
)
|
34
|
+
|
35
|
+
import deprecation
|
36
|
+
|
37
|
+
if TYPE_CHECKING:
|
38
|
+
import datetime as dt # noqa: F401
|
39
|
+
from another_ayx_python_sdk.providers.amp_provider.resources.generated.sdk_tool_service_v2_pb2 import (
|
40
|
+
ControlIn,
|
41
|
+
ControlOut,
|
42
|
+
RecordTransferIn, # noqa: F401
|
43
|
+
)
|
44
|
+
from pyarrow import Schema # noqa: F401
|
45
|
+
|
46
|
+
|
47
|
+
logger = logging.getLogger()
|
48
|
+
Anchor = namedtuple("Anchor", ["name", "connection"])
|
49
|
+
|
50
|
+
|
51
|
+
class StreamIOBuffer:
|
52
|
+
"""Defines buffers for RecordTransfer transactions, and provides functions for using them."""
|
53
|
+
|
54
|
+
pending_writes = asyncio.Queue() # type: ignore
|
55
|
+
completed_streams = asyncio.Queue() # type: ignore
|
56
|
+
transport = AmpStreamTransport()
|
57
|
+
|
58
|
+
def receive_chunk(self, msg: "RecordTransferIn") -> None:
|
59
|
+
"""Receive a RecordIn message containing a chunk or full arrows data stream."""
|
60
|
+
completed_record = self.transport.receive_record(msg)
|
61
|
+
|
62
|
+
if completed_record:
|
63
|
+
self.completed_streams.put_nowait(
|
64
|
+
{
|
65
|
+
"record_batch": completed_record,
|
66
|
+
"anchor": Anchor(
|
67
|
+
msg.incoming_records.anchor_name,
|
68
|
+
msg.incoming_records.connection_name,
|
69
|
+
),
|
70
|
+
}
|
71
|
+
)
|
72
|
+
|
73
|
+
def get_stream_msgs(self, record: Dict) -> "RecordTransferOut": # noqa: D102
|
74
|
+
"""
|
75
|
+
Yield n RecordOut messages with n arrow stream chunks and terminator.
|
76
|
+
|
77
|
+
Where:
|
78
|
+
- n is the set chunk size in AmpStreamTransport
|
79
|
+
- terminator is `end_of_chunk` in RecordOut.OutgoingRecords
|
80
|
+
"""
|
81
|
+
yield from self.transport.send_record(record["data"], record["anchor_name"])
|
82
|
+
|
83
|
+
def push_record(self, record: dict) -> None:
|
84
|
+
"""Push a arrows RecordBatch or Table to the write queue."""
|
85
|
+
self.pending_writes.put_nowait(record)
|
86
|
+
|
87
|
+
def write_to_buffer(self, name: str, payload: object) -> None: # noqa: D102
|
88
|
+
logger.debug("plugin called write for %s", name)
|
89
|
+
try:
|
90
|
+
self.push_record(
|
91
|
+
{"anchor_name": name, "data": payload, "write_type": "outgoing_records"}
|
92
|
+
)
|
93
|
+
except Exception as e:
|
94
|
+
logger.debug(repr(e))
|
95
|
+
|
96
|
+
async def flush(self) -> None:
|
97
|
+
"""
|
98
|
+
Flush queues in the safest order we can.
|
99
|
+
|
100
|
+
Wait until all streams are received from client, ensuring we call `on_record_batch` for all sent.
|
101
|
+
Handle any resulting writes from `on_record_batch` or other methods writing records.
|
102
|
+
"""
|
103
|
+
await self.completed_streams.join()
|
104
|
+
await self.pending_writes.join()
|
105
|
+
|
106
|
+
async def dump_queues(self) -> None:
|
107
|
+
"""Dump any remaining items from the queue. NOT atomic, and is destructive."""
|
108
|
+
for q in (self.completed_streams, self.pending_writes):
|
109
|
+
try:
|
110
|
+
q.get_nowait()
|
111
|
+
q.task_done()
|
112
|
+
except QueueEmpty:
|
113
|
+
logger.debug("Emptied %s", repr(q))
|
114
|
+
except Exception as e:
|
115
|
+
logger.error(
|
116
|
+
"Error occured while dumping ControlIO buffers! \n %s \n %s",
|
117
|
+
repr(q),
|
118
|
+
repr(e),
|
119
|
+
)
|
120
|
+
raise e
|
121
|
+
|
122
|
+
def push_close_anchor_msg(self, name: str) -> None:
|
123
|
+
"""Send ControlOut with CloseOutgoingAnchor."""
|
124
|
+
msg = RecordTransferOut()
|
125
|
+
msg.close_outgoing_anchor.name = name
|
126
|
+
self.push_record({"message": msg, "write_type": "close_outgoing_anchor"})
|
127
|
+
|
128
|
+
|
129
|
+
class ControlIOBuffer:
|
130
|
+
"""Component Class that wraps all Control IO for the server."""
|
131
|
+
|
132
|
+
# Ignoring type as these are always fresh inits
|
133
|
+
ctrl_in_callback = asyncio.Queue() # type: ignore
|
134
|
+
ctrl_out = asyncio.Queue() # type: ignore
|
135
|
+
ctrl_driver_actions = asyncio.Queue() # type: ignore
|
136
|
+
ctrl_user_callback_actions = asyncio.Queue() # type: ignore
|
137
|
+
awaiting_response: Dict[str, Callable] = {}
|
138
|
+
blocking_awaiting_response: Dict[str, Any] = {}
|
139
|
+
|
140
|
+
def push_ctrl_out(
|
141
|
+
self, msg: "ControlOut", callback_fn: Optional["Callable"] = None
|
142
|
+
) -> None:
|
143
|
+
"""Push ControlOut to the write queue, notifying server it has something to send."""
|
144
|
+
if callback_fn:
|
145
|
+
self.awaiting_response[msg.msg_id] = callback_fn
|
146
|
+
self.ctrl_out.put_nowait(msg)
|
147
|
+
|
148
|
+
async def flush(self) -> None:
|
149
|
+
"""
|
150
|
+
Shutdown in the safest order possible.
|
151
|
+
|
152
|
+
Let workers empty the control out queue to send any remaining processing needs.
|
153
|
+
Wait for any responses to be handled.
|
154
|
+
Let workers empty and handle any responses from the client from ctrl_out queue flush.
|
155
|
+
Let workers finish any pending actions resulting from the above.
|
156
|
+
"""
|
157
|
+
# Loop until any outstanding callback responses are handled.
|
158
|
+
while len(self.awaiting_response) > 0:
|
159
|
+
# While we have any requests waiting for a response,
|
160
|
+
# send pending requests, execute any current or resulting callbacks
|
161
|
+
await self.ctrl_out.join()
|
162
|
+
await asyncio.sleep(0)
|
163
|
+
await self.ctrl_in_callback.join()
|
164
|
+
await self.ctrl_driver_actions.join()
|
165
|
+
# loop again if we generated any new awaits
|
166
|
+
# otherwise, "done" with this set of ops
|
167
|
+
|
168
|
+
async def dump_queues(self) -> None:
|
169
|
+
"""Dump remaining items in all queues. NOT atomic, and destructive."""
|
170
|
+
for q in (self.ctrl_in_callback, self.ctrl_out, self.ctrl_driver_actions):
|
171
|
+
try:
|
172
|
+
q.get_nowait()
|
173
|
+
q.task_done()
|
174
|
+
except QueueEmpty:
|
175
|
+
logger.debug("Emptied %s", repr(q))
|
176
|
+
except Exception as e:
|
177
|
+
logger.error(
|
178
|
+
"Error occured while dumping ControlIO buffers! \n %s \n %s",
|
179
|
+
repr(q),
|
180
|
+
repr(e),
|
181
|
+
)
|
182
|
+
raise e
|
183
|
+
|
184
|
+
def push_driver_callback(
|
185
|
+
self, driver_fn: Callable, *args: tuple, **kwargs: dict
|
186
|
+
) -> asyncio.Event:
|
187
|
+
"""Push a driver function and parameters. For callables that do not require a client response as an argument."""
|
188
|
+
logger.debug(f"pushing callback {driver_fn}")
|
189
|
+
event_cb_complete = asyncio.Event()
|
190
|
+
action = {
|
191
|
+
"driver_fn": driver_fn,
|
192
|
+
"args": args,
|
193
|
+
"kwargs": kwargs,
|
194
|
+
"event_cb_complete": event_cb_complete,
|
195
|
+
}
|
196
|
+
self.ctrl_driver_actions.put_nowait(action)
|
197
|
+
return event_cb_complete
|
198
|
+
|
199
|
+
def push_callback_action(self, msg: "ControlIn") -> None:
|
200
|
+
"""Place the response message and assigned callback on the action queue."""
|
201
|
+
logging.debug("Received callback response, pushing compute...")
|
202
|
+
prop_key = msg.WhichOneof("payload")
|
203
|
+
if prop_key == "dcm_e_response":
|
204
|
+
try:
|
205
|
+
resp_msg = dcm_msg.handle_response(msg.dcm_e_response)
|
206
|
+
except DcmEException as e:
|
207
|
+
logger.error(f"DCME raised exception {repr(e)}")
|
208
|
+
raise e
|
209
|
+
else:
|
210
|
+
resp_msg = getattr(msg, prop_key)
|
211
|
+
try:
|
212
|
+
action_item = {
|
213
|
+
"response_msg": resp_msg,
|
214
|
+
"callback_fn": self.awaiting_response.pop(msg.msg_id),
|
215
|
+
}
|
216
|
+
self.ctrl_user_callback_actions.put_nowait(action_item)
|
217
|
+
except KeyError as e:
|
218
|
+
logger.error(f"CONTROLIO received msg with invalid ID! \n {repr(e)}")
|
219
|
+
raise e
|
220
|
+
|
221
|
+
def error_with_priority(
|
222
|
+
self, priority: int, error_msg: str, *args: Any
|
223
|
+
) -> None: # noqa: D102
|
224
|
+
if args:
|
225
|
+
msg = ctrl_msg.new_ctrl_out_error_msg(error_msg.format(*args), priority)
|
226
|
+
else:
|
227
|
+
msg = ctrl_msg.new_ctrl_out_error_msg(error_msg, priority)
|
228
|
+
self.push_ctrl_out(msg)
|
229
|
+
|
230
|
+
def warn_with_priority(
|
231
|
+
self, priority: int, warn_msg: str, *args: Any
|
232
|
+
) -> None: # noqa: D102
|
233
|
+
if args:
|
234
|
+
msg = ctrl_msg.new_ctrl_out_warn_msg(warn_msg.format(*args), priority)
|
235
|
+
else:
|
236
|
+
msg = ctrl_msg.new_ctrl_out_warn_msg(warn_msg, priority)
|
237
|
+
self.push_ctrl_out(msg)
|
238
|
+
|
239
|
+
def info_with_priority(
|
240
|
+
self, priority: int, info_msg: str, *args: Any
|
241
|
+
) -> None: # noqa: D102
|
242
|
+
if args:
|
243
|
+
msg = ctrl_msg.new_ctrl_out_info_msg(info_msg.format(*args), priority)
|
244
|
+
else:
|
245
|
+
msg = ctrl_msg.new_ctrl_out_info_msg(info_msg, priority)
|
246
|
+
self.push_ctrl_out(msg)
|
247
|
+
|
248
|
+
def error(self, error_msg: str, *args: Any) -> None: # noqa: D102
|
249
|
+
self.error_with_priority(OutputMessagePriorityFlags.OMPF_None, error_msg, *args)
|
250
|
+
|
251
|
+
def warn(self, warn_msg: str, *args: Any) -> None: # noqa: D102
|
252
|
+
self.warn_with_priority(OutputMessagePriorityFlags.OMPF_None, warn_msg, *args)
|
253
|
+
|
254
|
+
def info(self, info_str: str, *args: Any) -> None: # noqa: D102
|
255
|
+
self.info_with_priority(OutputMessagePriorityFlags.OMPF_None, info_str, *args)
|
256
|
+
|
257
|
+
@deprecation.deprecated(
|
258
|
+
deprecated_in="1.0.2",
|
259
|
+
details="Use functions of provider's dcm property instead",
|
260
|
+
) # type: ignore
|
261
|
+
def decrypt_password(self, encrypted_pass: str) -> str:
|
262
|
+
"""Decrypt the passed value and return readable."""
|
263
|
+
# Need to resolve whether or not this is a different call since latest DCM changes.
|
264
|
+
try:
|
265
|
+
logger.debug("Creating password message...")
|
266
|
+
msg = ctrl_msg.new_ctrl_out_decrypt_msg(encrypted_pass)
|
267
|
+
self.blocking_awaiting_response[msg.msg_id] = None
|
268
|
+
self.push_ctrl_out(msg)
|
269
|
+
logger.debug("Waiting for response from client...")
|
270
|
+
while self.blocking_awaiting_response[msg.msg_id] is None:
|
271
|
+
# Wait for a response. An event may be cleaner looking. Hint for hardening time.
|
272
|
+
time.sleep(0)
|
273
|
+
result = self.blocking_awaiting_response.pop(msg.msg_id)
|
274
|
+
return result.password
|
275
|
+
except Exception as e:
|
276
|
+
logger.error(repr(e))
|
277
|
+
raise e
|
278
|
+
|
279
|
+
def translate_msg_use_callback(
|
280
|
+
self, source_str: str, interp_args: list, callback_fn: Callable
|
281
|
+
) -> None:
|
282
|
+
"""
|
283
|
+
Push the msg to the write queue, and assign a reference id for the passed callback.
|
284
|
+
|
285
|
+
DOES NOT BLOCK, and only guarantees the callback will be run before plugin shutdown.
|
286
|
+
"""
|
287
|
+
try:
|
288
|
+
logger.debug("Creating Translate Message...")
|
289
|
+
msg = ctrl_msg.new_ctrl_out_translate_msg(source_str, *interp_args)
|
290
|
+
logger.debug("Callback Assigned, pushing out msg")
|
291
|
+
self.push_ctrl_out(msg, callback_fn)
|
292
|
+
except Exception as e:
|
293
|
+
logger.debug(repr(e))
|
294
|
+
|
295
|
+
def translate_msg(self, source_str: str, *interp_args: list) -> str:
|
296
|
+
"""Push the msg to the write queue, and block until response."""
|
297
|
+
try:
|
298
|
+
logger.debug("Creating Translate Message...")
|
299
|
+
msg = ctrl_msg.new_ctrl_out_translate_msg(source_str, *interp_args)
|
300
|
+
self.blocking_awaiting_response[msg.msg_id] = None
|
301
|
+
self.push_ctrl_out(msg)
|
302
|
+
logger.debug("Waiting for response from client...")
|
303
|
+
while self.blocking_awaiting_response[msg.msg_id] is None:
|
304
|
+
# Wait for a response. An event may be cleaner looking. Hint for hardening time.
|
305
|
+
time.sleep(0)
|
306
|
+
result = self.blocking_awaiting_response.pop(msg.msg_id)
|
307
|
+
return result.translated_message
|
308
|
+
except Exception as e:
|
309
|
+
logger.error(repr(e))
|
310
|
+
raise e
|
311
|
+
|
312
|
+
def update_progress(self, progress: float) -> None:
|
313
|
+
"""Push the msg to the write queue, and block until response."""
|
314
|
+
try:
|
315
|
+
logger.debug("Creating UpdateProgress Message...")
|
316
|
+
msg = ctrl_msg.new_ctrl_out_update_progress_msg(progress)
|
317
|
+
self.push_ctrl_out(msg)
|
318
|
+
except Exception as e:
|
319
|
+
logger.error(repr(e))
|
320
|
+
raise e
|
321
|
+
|
322
|
+
def get_connection(
|
323
|
+
self, connection_id: str, callback_fn: Callable
|
324
|
+
) -> None: # noqa: D102
|
325
|
+
msg = dcm_msg.get_connection_msg(connection_id)
|
326
|
+
self.push_ctrl_out(msg, callback_fn)
|
327
|
+
|
328
|
+
def get_write_lock(
|
329
|
+
self,
|
330
|
+
connection_id: str,
|
331
|
+
role: str,
|
332
|
+
secret_type: str,
|
333
|
+
expires_in: Optional["dt.datetime"],
|
334
|
+
callback_fn: Callable,
|
335
|
+
) -> None: # noqa: D102
|
336
|
+
msg = dcm_msg.get_write_lock_msg(connection_id, role, secret_type, expires_in)
|
337
|
+
self.push_ctrl_out(msg, callback_fn)
|
338
|
+
|
339
|
+
def free_write_lock(
|
340
|
+
self,
|
341
|
+
connection_id: str,
|
342
|
+
role: str,
|
343
|
+
secret_type: str,
|
344
|
+
lock_id: str,
|
345
|
+
callback_fn: Optional[Callable] = None,
|
346
|
+
) -> None: # noqa: D102
|
347
|
+
msg = dcm_msg.free_write_lock_msg(connection_id, role, secret_type, lock_id)
|
348
|
+
self.push_ctrl_out(msg, callback_fn)
|
349
|
+
|
350
|
+
def update_connection_secret(
|
351
|
+
self,
|
352
|
+
connection_id: str,
|
353
|
+
role: str,
|
354
|
+
secret_type: str,
|
355
|
+
value: str,
|
356
|
+
expires_on: Optional["dt.datetime"],
|
357
|
+
parameters: Optional[Dict[str, str]],
|
358
|
+
lock_id: str,
|
359
|
+
callback_fn: Optional[Callable] = None,
|
360
|
+
) -> None: # noqa: D102
|
361
|
+
msg = dcm_msg.update_connection_secret_msg(
|
362
|
+
connection_id, lock_id, role, secret_type, value, expires_on, parameters
|
363
|
+
)
|
364
|
+
self.push_ctrl_out(msg, callback_fn)
|
365
|
+
|
366
|
+
def get_lock_and_update_secret(
|
367
|
+
self,
|
368
|
+
connection_id: str,
|
369
|
+
role: str,
|
370
|
+
secret_type: str,
|
371
|
+
value: str,
|
372
|
+
expires_on: Optional["dt.datetime"],
|
373
|
+
parameters: Optional[Dict[str, str]],
|
374
|
+
on_complete: Optional[Callable] = None,
|
375
|
+
) -> None:
|
376
|
+
"""Set up a callback chain to request a lock, update a secret, and then free the lock."""
|
377
|
+
common_args = (connection_id, role, secret_type)
|
378
|
+
|
379
|
+
secret_lock_id = ""
|
380
|
+
|
381
|
+
def _free_lock() -> None:
|
382
|
+
nonlocal secret_lock_id
|
383
|
+
|
384
|
+
self.free_write_lock(
|
385
|
+
connection_id,
|
386
|
+
role,
|
387
|
+
secret_type,
|
388
|
+
secret_lock_id,
|
389
|
+
callback_fn=on_complete,
|
390
|
+
)
|
391
|
+
|
392
|
+
def _update_with_lock(resp: dict) -> None:
|
393
|
+
nonlocal secret_lock_id
|
394
|
+
secret_lock_id = resp["secretLockId"]
|
395
|
+
|
396
|
+
self.update_connection_secret(
|
397
|
+
connection_id,
|
398
|
+
role,
|
399
|
+
secret_type,
|
400
|
+
value,
|
401
|
+
expires_on,
|
402
|
+
parameters,
|
403
|
+
secret_lock_id,
|
404
|
+
callback_fn=_free_lock,
|
405
|
+
)
|
406
|
+
|
407
|
+
self.get_write_lock(*common_args, None, _update_with_lock)
|
@@ -0,0 +1,107 @@
|
|
1
|
+
# Copyright (C) 2022 Alteryx, Inc. All rights reserved.
|
2
|
+
#
|
3
|
+
# Licensed under the ALTERYX SDK AND API LICENSE AGREEMENT;
|
4
|
+
# you may not use this file except in compliance with the License.
|
5
|
+
# You may obtain a copy of the License at
|
6
|
+
#
|
7
|
+
# https://www.alteryx.com/alteryx-sdk-and-api-license-agreement
|
8
|
+
#
|
9
|
+
# Unless required by applicable law or agreed to in writing, software
|
10
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
11
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
12
|
+
# See the License for the specific language governing permissions and
|
13
|
+
# limitations under the License.
|
14
|
+
"""AMP Provider: Plugin Output Anchor class definition."""
|
15
|
+
import logging
|
16
|
+
from typing import Optional, TYPE_CHECKING
|
17
|
+
|
18
|
+
from another_ayx_python_sdk.core import (
|
19
|
+
Metadata,
|
20
|
+
OutputAnchorBase,
|
21
|
+
RecordPacketBase,
|
22
|
+
)
|
23
|
+
from another_ayx_python_sdk.core.doc_utilities import inherit_docs
|
24
|
+
from another_ayx_python_sdk.providers.amp_provider.repositories import (
|
25
|
+
OutputMetadataRepository,
|
26
|
+
OutputRecordPacketRepository,
|
27
|
+
)
|
28
|
+
|
29
|
+
if TYPE_CHECKING:
|
30
|
+
import pandas as pd # noqa: F401
|
31
|
+
|
32
|
+
logger = logging.getLogger(__name__)
|
33
|
+
|
34
|
+
|
35
|
+
@inherit_docs
|
36
|
+
class AMPOutputAnchor(OutputAnchorBase):
|
37
|
+
"""Manage the tool's output anchor in AMP Provider."""
|
38
|
+
|
39
|
+
def __init__(
|
40
|
+
self,
|
41
|
+
name: str,
|
42
|
+
allow_multiple: bool = False,
|
43
|
+
optional: bool = False,
|
44
|
+
num_connections: int = 0,
|
45
|
+
) -> None:
|
46
|
+
self.__name: str = name
|
47
|
+
self.__allow_multiple: bool = allow_multiple
|
48
|
+
self.__optional: bool = optional
|
49
|
+
self.__num_connections: int = num_connections
|
50
|
+
self.written_dataframe: Optional["pd.Dataframe"] = None
|
51
|
+
logger.debug("Created output anchor %s", self.name)
|
52
|
+
|
53
|
+
@property
|
54
|
+
def name(self) -> str: # noqa: D102
|
55
|
+
return self.__name
|
56
|
+
|
57
|
+
@property
|
58
|
+
def allow_multiple(self) -> bool: # noqa: D102
|
59
|
+
return self.__allow_multiple
|
60
|
+
|
61
|
+
@property
|
62
|
+
def optional(self) -> bool: # noqa: D102
|
63
|
+
return self.__optional
|
64
|
+
|
65
|
+
@property
|
66
|
+
def num_connections(self) -> int: # noqa: D102
|
67
|
+
return self.__num_connections
|
68
|
+
|
69
|
+
@property
|
70
|
+
def is_open(self) -> bool: # noqa: D102
|
71
|
+
try:
|
72
|
+
OutputMetadataRepository().get_metadata(self.name)
|
73
|
+
except ValueError:
|
74
|
+
return False
|
75
|
+
else:
|
76
|
+
return True
|
77
|
+
|
78
|
+
@property
|
79
|
+
def metadata(self) -> Optional["Metadata"]: # noqa: D102
|
80
|
+
if self.is_open:
|
81
|
+
return OutputMetadataRepository().get_metadata(self.name)
|
82
|
+
return None
|
83
|
+
|
84
|
+
def open(self, metadata: "Metadata") -> None: # noqa: D102
|
85
|
+
logger.debug("Opening Output Anchor %s", self.name)
|
86
|
+
OutputMetadataRepository().save_metadata(self.name, metadata)
|
87
|
+
|
88
|
+
def write(self, record_packet: "RecordPacketBase") -> None: # noqa: D102
|
89
|
+
if self.metadata is None:
|
90
|
+
raise RuntimeError("Output anchor is not open.")
|
91
|
+
|
92
|
+
if record_packet.metadata != self.metadata:
|
93
|
+
raise RuntimeError(
|
94
|
+
"Output anchor's metadata does not match incoming record packet."
|
95
|
+
)
|
96
|
+
|
97
|
+
OutputRecordPacketRepository().save_record_packet(self.name, record_packet)
|
98
|
+
|
99
|
+
def flush(self) -> None: # noqa: D102
|
100
|
+
raise NotImplementedError
|
101
|
+
|
102
|
+
def close(self) -> None: # noqa: D102
|
103
|
+
logger.debug("Closing Output Anchor %s", self.name)
|
104
|
+
OutputMetadataRepository().delete_metadata(self.name)
|
105
|
+
|
106
|
+
def update_progress(self, percentage: float) -> None: # noqa: D102
|
107
|
+
OutputRecordPacketRepository().save_anchor_progress(self.name, percentage)
|
@@ -0,0 +1,68 @@
|
|
1
|
+
# Copyright (C) 2022 Alteryx, Inc. All rights reserved.
|
2
|
+
#
|
3
|
+
# Licensed under the ALTERYX SDK AND API LICENSE AGREEMENT;
|
4
|
+
# you may not use this file except in compliance with the License.
|
5
|
+
# You may obtain a copy of the License at
|
6
|
+
#
|
7
|
+
# https://www.alteryx.com/alteryx-sdk-and-api-license-agreement
|
8
|
+
#
|
9
|
+
# Unless required by applicable law or agreed to in writing, software
|
10
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
11
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
12
|
+
# See the License for the specific language governing permissions and
|
13
|
+
# limitations under the License.
|
14
|
+
"""AMP Provider: SDK Provider class definition."""
|
15
|
+
from logging import Logger, getLogger
|
16
|
+
from typing import Dict, TYPE_CHECKING
|
17
|
+
|
18
|
+
from another_ayx_python_sdk.core import ProviderBase
|
19
|
+
from another_ayx_python_sdk.core.doc_utilities import inherit_docs
|
20
|
+
from another_ayx_python_sdk.providers.amp_provider import AMPEnvironment
|
21
|
+
from another_ayx_python_sdk.providers.amp_provider.amp_dcm import AMPDCM
|
22
|
+
from another_ayx_python_sdk.providers.amp_provider.amp_io import AMPIO
|
23
|
+
from another_ayx_python_sdk.providers.amp_provider.repositories import InputAnchorRepository
|
24
|
+
from another_ayx_python_sdk.providers.amp_provider.repositories import OutputAnchorRepository
|
25
|
+
from another_ayx_python_sdk.providers.amp_provider.repositories import ToolConfigRepository
|
26
|
+
|
27
|
+
if TYPE_CHECKING:
|
28
|
+
from another_ayx_python_sdk.providers.amp_provider.amp_input_anchor import AMPInputAnchor
|
29
|
+
from another_ayx_python_sdk.providers.amp_provider.amp_output_anchor import AMPOutputAnchor
|
30
|
+
from another_ayx_python_sdk.providers.amp_provider.amp_driver import AMPDriver
|
31
|
+
|
32
|
+
|
33
|
+
@inherit_docs
|
34
|
+
class AMPProvider(ProviderBase):
|
35
|
+
"""Class that provides resources to plugins that are run with the AMP Provider."""
|
36
|
+
|
37
|
+
def __init__(self) -> None:
|
38
|
+
"""Initialize the AMP resource provider."""
|
39
|
+
self.__environment: "AMPEnvironment" = AMPEnvironment()
|
40
|
+
self.__io: "AMPIO" = AMPIO()
|
41
|
+
self.__dcm: "AMPDCM" = AMPDCM()
|
42
|
+
self._driver: "AMPDriver" = None
|
43
|
+
|
44
|
+
@property
|
45
|
+
def logger(self) -> "Logger": # noqa: D102
|
46
|
+
return getLogger()
|
47
|
+
|
48
|
+
@property
|
49
|
+
def io(self) -> "AMPIO": # noqa: D102
|
50
|
+
return self.__io
|
51
|
+
|
52
|
+
@property
|
53
|
+
def dcm(self) -> "AMPDCM": # noqa: D102
|
54
|
+
return self.__dcm
|
55
|
+
|
56
|
+
@property
|
57
|
+
def environment(self) -> "AMPEnvironment": # noqa: D102
|
58
|
+
return self.__environment
|
59
|
+
|
60
|
+
def get_input_anchor(self, name: str) -> "AMPInputAnchor": # noqa: D102
|
61
|
+
return InputAnchorRepository().get_anchor(name)
|
62
|
+
|
63
|
+
def get_output_anchor(self, name: str) -> "AMPOutputAnchor": # noqa: D102
|
64
|
+
return OutputAnchorRepository().get_anchor(name)
|
65
|
+
|
66
|
+
@property
|
67
|
+
def tool_config(self) -> Dict: # noqa: D102
|
68
|
+
return ToolConfigRepository().get_tool_config()
|