Esempio n. 1
0
class _MyType(Artifact):
    TYPE_NAME = 'MyTypeName'
    PROPERTIES = {
        'string_value': Property(PropertyType.STRING),
    }
Esempio n. 2
0
"""

from __future__ import absolute_import
from __future__ import division
from __future__ import print_function

import struct
from typing import Text

from tfx.types.artifact import Artifact
from tfx.types.artifact import Property
from tfx.types.artifact import PropertyType
from tfx.types.artifact import ValueArtifact

# Span for an artifact.
SPAN_PROPERTY = Property(type=PropertyType.INT)
# Comma separated of splits for an artifact. Empty string means artifact
# has no split.
SPLIT_NAMES_PROPERTY = Property(type=PropertyType.STRING)
# Value for a string-typed artifact.
STRING_VALUE_PROPERTY = Property(type=PropertyType.STRING)


class Examples(Artifact):
  TYPE_NAME = 'Examples'
  PROPERTIES = {
      'span': SPAN_PROPERTY,
      'split_names': SPLIT_NAMES_PROPERTY,
  }

from tfx.types import standard_artifacts
from tfx.types.artifact import Property
from tfx.types.artifact import PropertyType
from tfx.types.component_spec import ChannelParameter
from tfx.types.component_spec import ExecutionParameter
from tfx.types.component_spec import ComponentSpec
from tfx.components.base import base_component
from tfx.types import channel_utils

import apache_beam as beam
import pickle
import google.auth
import google.cloud.storage as storage

# Span for an artifact.
SPAN_PROPERTY = Property(type=PropertyType.INT)
# Version for an artifact.
VERSION_PROPERTY = Property(type=PropertyType.INT)
# Version for an artifact.
SPLIT_NAMES_PROPERTY = Property(type=PropertyType.STRING)


class TCGAPreprocessingSpec(ComponentSpec):
    """TFX Custom TCGAPreprocessing component spec."""

    PARAMETERS = {
        'query': ExecutionParameter(type=Text),
        'output_schema': ExecutionParameter(type=Any),
        'table_name': ExecutionParameter(type=Text),
        'use_bigquery_source': ExecutionParameter(type=Any),
Esempio n. 4
0
class _MyType(Artifact):
    TYPE_NAME = "MyTypeName"
    PROPERTIES = {
        "string_value": Property(PropertyType.STRING),
    }
Esempio n. 5
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.
from typing import Dict

from tfx.types.artifact import Artifact, Property, PropertyType

from zenml.artifacts.constants import (
    DATATYPE_PROPERTY_KEY,
    MATERIALIZER_PROPERTY_KEY,
)

MATERIALIZER_PROPERTY = Property(
    type=PropertyType.STRING)  # type: ignore[no-untyped-call] # noqa
DATATYPE_PROPERTY = Property(
    type=PropertyType.STRING)  # type: ignore[no-untyped-call] # noqa


class BaseArtifact(Artifact):
    """Base class for all ZenML artifacts.

    Every implementation of an artifact needs to inherit this class.

    While inheriting from this class there are a few things to consider:

    - Upon creation, each artifact class needs to be given a unique TYPE_NAME.
    - Your artifact can feature different properties under the parameter
        PROPERTIES which will be tracked throughout your pipeline runs.
    """