How to use the dbnd._vendor.marshmallow.fields function in dbnd

To help you get started, we’ve selected a few dbnd examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github databand-ai / dbnd / modules / dbnd / src / dbnd / api / shared_schemas / airflow_monitor.py View on Github external
import attr

from dbnd._vendor.marshmallow import fields, post_load
from dbnd.api.api_utils import _ApiCallSchema


class AirflowServerInfoSchema(_ApiCallSchema):
    base_url = fields.String()
    airflow_version = fields.String(allow_none=True)
    airflow_export_version = fields.String(allow_none=True)
    airflow_monitor_version = fields.String(allow_none=True)
    dags_path = fields.String(allow_none=True)
    logs_path = fields.String(allow_none=True)
    last_sync_time = fields.DateTime(allow_none=True)
    monitor_status = fields.String(allow_none=True)
    monitor_error_message = fields.String(allow_none=True)
    monitor_start_time = fields.DateTime(allow_none=True)
    synced_from = fields.DateTime(allow_none=True)
    synced_to = fields.DateTime(allow_none=True)
    rbac_enabled = fields.Boolean(allow_none=True)
    sync_interval = fields.Integer(allow_none=True)

    @post_load
    def make_object(self, data, **kwargs):
github databand-ai / dbnd / modules / dbnd / src / dbnd / api / shared_schemas / scheduled_job_schema.py View on Github external
uid = fields.Str(attribute="DbndScheduledJob.uid", allow_none=True)
    name = fields.Str(attribute="DbndScheduledJob.name", required=True)
    cmd = fields.Str(attribute="DbndScheduledJob.cmd", required=True)
    schedule_interval = fields.Str(
        attribute="DbndScheduledJob.schedule_interval", required=True
    )
    start_date = fields.DateTime(
        allow_none=True, attribute="DbndScheduledJob.start_date", format="iso"
    )
    end_date = fields.DateTime(
        allow_none=True, attribute="DbndScheduledJob.end_date", format="iso"
    )
    readable_schedule_interval = fields.Str(
        attribute="DbndScheduledJob.readable_schedule_interval", allow_none=True
    )
    scheduled_interval_in_seconds = fields.Integer(
        attribute="DbndScheduledJob.scheduled_interval_in_seconds", allow_none=True
    )
    catchup = fields.Boolean(allow_none=True, attribute="DbndScheduledJob.catchup")
    depends_on_past = fields.Boolean(
        allow_none=True, attribute="DbndScheduledJob.depends_on_past"
    )
    retries = fields.Int(allow_none=True, attribute="DbndScheduledJob.retries")

    active = fields.Boolean(allow_none=True, attribute="DbndScheduledJob.active")
    create_user = fields.Str(allow_none=True, attribute="DbndScheduledJob.create_user")
    create_time = fields.DateTime(
        allow_none=True, attribute="DbndScheduledJob.create_time"
    )
    update_user = fields.Str(allow_none=True, attribute="DbndScheduledJob.update_user")
    update_time = fields.DateTime(
        allow_none=True, attribute="DbndScheduledJob.update_time"
github databand-ai / dbnd / modules / dbnd / src / dbnd / api / serialization / task_run_env.py View on Github external
from dbnd._core.tracking.tracking_info_objects import TaskRunEnvInfo
from dbnd._vendor.marshmallow import fields, post_load
from dbnd.api.api_utils import ApiObjectSchema


class TaskRunEnvInfoSchema(ApiObjectSchema):
    uid = fields.UUID()
    cmd_line = fields.String()

    user = fields.String()
    machine = fields.String()
    databand_version = fields.String()

    user_code_version = fields.String()
    user_code_committed = fields.Boolean()
    project_root = fields.String()

    user_data = fields.String()

    heartbeat = fields.DateTime()

    @post_load
    def make_object(self, data, **kwargs):
github databand-ai / dbnd / modules / dbnd / src / dbnd / api / tracking_api.py View on Github external
class ScheduledJobInfoSchema(ApiObjectSchema):
    uid = fields.UUID()
    name = fields.String()
    cmd = fields.String()
    start_date = fields.DateTime()
    create_user = fields.String()
    create_time = fields.DateTime()
    end_date = fields.DateTime(allow_none=True)
    schedule_interval = fields.String(allow_none=True)
    catchup = fields.Boolean(allow_none=True)
    depends_on_past = fields.Boolean(allow_none=True)
    retries = fields.Integer(allow_none=True)
    active = fields.Boolean(allow_none=True)
    update_user = fields.String(allow_none=True)
    update_time = fields.DateTime(allow_none=True)
    from_file = fields.Boolean(allow_none=True)
    deleted_from_file = fields.Boolean(allow_none=True)
    list_order = fields.Integer(allow_none=True)
    job_name = fields.String(allow_none=True)

    @post_load
    def make_object(self, data, **kwargs):
        return ScheduledJobInfo(**data)


class ScheduledJobArgsSchema(_ApiCallSchema):
    scheduled_job_args = fields.Nested(ScheduledJobInfoSchema)


scheduled_job_args_schema = ScheduledJobArgsSchema()
github databand-ai / dbnd / modules / dbnd / src / dbnd / api / serialization / run.py View on Github external
class ScheduledRunInfoSchema(ApiObjectSchema):
    scheduled_job_uid = fields.UUID(allow_none=True)
    scheduled_date = fields.DateTime(allow_none=True)
    scheduled_job_dag_run_id = fields.String(allow_none=True)
    scheduled_job_name = fields.String(allow_none=True)

    @post_load
    def make_object(self, data, **kwargs):
        return _as_dotted_dict(**data)


class RootRunInfoSchema(ApiObjectSchema):
    root_run_uid = fields.UUID()
    root_task_run_uid = fields.UUID(allow_none=True)
    root_task_run_attempt_uid = fields.UUID(allow_none=True)
    root_run_url = fields.String(allow_none=True)

    @post_load
    def make_object(self, data, **kwargs):
        return _as_dotted_dict(**data)


class RunInfoSchema(ApiObjectSchema):
    root_run_uid = fields.UUID()
    run_uid = fields.UUID()

    job_name = fields.String()
    user = fields.String()

    name = fields.String()
    description = fields.String(allow_none=True)
github databand-ai / dbnd / modules / dbnd / src / dbnd / api / serialization / task.py View on Github external
is_reused = fields.Boolean()
    is_dynamic = fields.Boolean()
    is_system = fields.Boolean()
    is_skipped = fields.Boolean()
    is_root = fields.Boolean()
    output_signature = fields.String()

    state = EnumField(TaskRunState)
    target_date = fields.Date(allow_none=True)

    log_local = fields.String(allow_none=True)
    log_remote = fields.String(allow_none=True)

    version = fields.String()

    task_run_params = fields.Nested(TaskRunParamSchema, many=True)

    @post_load
    def make_task_run(self, data, **kwargs):
        return TaskRunInfo(**data)
github databand-ai / dbnd / modules / dbnd / src / dbnd / api / serialization / run.py View on Github external
from dbnd.api.api_utils import ApiObjectSchema, _as_dotted_dict


class ScheduledRunInfoSchema(ApiObjectSchema):
    scheduled_job_uid = fields.UUID(allow_none=True)
    scheduled_date = fields.DateTime(allow_none=True)
    scheduled_job_dag_run_id = fields.String(allow_none=True)
    scheduled_job_name = fields.String(allow_none=True)

    @post_load
    def make_object(self, data, **kwargs):
        return _as_dotted_dict(**data)


class RootRunInfoSchema(ApiObjectSchema):
    root_run_uid = fields.UUID()
    root_task_run_uid = fields.UUID(allow_none=True)
    root_task_run_attempt_uid = fields.UUID(allow_none=True)
    root_run_url = fields.String(allow_none=True)

    @post_load
    def make_object(self, data, **kwargs):
        return _as_dotted_dict(**data)


class RunInfoSchema(ApiObjectSchema):
    root_run_uid = fields.UUID()
    run_uid = fields.UUID()

    job_name = fields.String()
    user = fields.String()
github databand-ai / dbnd / modules / dbnd / src / dbnd / api / serialization / task.py View on Github external
return TaskDefinitionInfo(**data)


class TaskRunParamSchema(ApiObjectSchema):
    parameter_name = fields.String()
    value_origin = fields.String()
    value = fields.String()

    @post_load
    def make_task_run_param(self, data, **kwargs):
        return TaskRunParamInfo(**data)


class TaskRunInfoSchema(ApiObjectSchema):
    task_run_uid = fields.UUID()
    task_run_attempt_uid = fields.UUID()

    task_definition_uid = fields.UUID()
    run_uid = fields.UUID()
    task_id = fields.String()
    task_signature = fields.String()
    task_signature_source = fields.String()

    task_af_id = fields.String()
    execution_date = fields.DateTime()

    name = fields.String()

    env = fields.String()

    command_line = fields.String()
    functional_call = fields.String()
github databand-ai / dbnd / modules / dbnd / src / dbnd / api / serialization / task.py View on Github external
task_definition_uid = fields.UUID()
    run_uid = fields.UUID()
    task_id = fields.String()
    task_signature = fields.String()
    task_signature_source = fields.String()

    task_af_id = fields.String()
    execution_date = fields.DateTime()

    name = fields.String()

    env = fields.String()

    command_line = fields.String()
    functional_call = fields.String()

    has_downstreams = fields.Boolean()
    has_upstreams = fields.Boolean()

    is_reused = fields.Boolean()
    is_dynamic = fields.Boolean()
    is_system = fields.Boolean()
    is_skipped = fields.Boolean()
    is_root = fields.Boolean()
    output_signature = fields.String()

    state = EnumField(TaskRunState)
    target_date = fields.Date(allow_none=True)

    log_local = fields.String(allow_none=True)
    log_remote = fields.String(allow_none=True)
github databand-ai / dbnd / modules / dbnd / src / dbnd / api / api_utils.py View on Github external
import requests

from dbnd._core.errors.base import DatabandApiError
from dbnd._core.errors.friendly_error.api import api_connection_refused
from dbnd._vendor.marshmallow import Schema, fields


logger = logging.getLogger(__name__)


# uncomment for requests trace
# import http.client
# http.client.HTTPConnection.debuglevel = 1


class AlwaysString(fields.Field):
    def _serialize(self, value, attr, obj):
        if value is not None:
            return str(value.value)


class ApiClient(object):
    """Json API client implementation."""

    api_prefix = "/api/v1/"

    def __init__(self, api_base_url, auth=None, user="databand", password="databand"):
        self._api_base_url = api_base_url
        self.auth = auth
        self.user = user
        self.password = password
        self.session = None