Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
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):
return TaskRunEnvInfo(**data)
update_time = attr.ib(default=None) # type: Optional[datetime.datetime]
from_file = attr.ib(default=False) # type: bool
deleted_from_file = attr.ib(default=False) # type: bool
list_order = attr.ib(default=None) # type: List[int]
job_name = attr.ib(default=None) # type: Optional[str]
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)
group = EnumField(ParameterGroup)
kind = EnumField(_ParameterKind)
load_on_build = fields.Boolean()
significant = fields.Boolean()
value_type = fields.String()
@post_load
def make_task_definition_param(self, data, **kwargs):
return _as_dotted_dict(**data)
class TaskDefinitionInfoSchema(ApiObjectSchema):
task_definition_uid = fields.UUID()
name = fields.String()
class_version = fields.String()
family = fields.String()
module_source = fields.String(allow_none=True)
module_source_hash = fields.String(allow_none=True)
source = fields.String(allow_none=True)
source_hash = fields.String(allow_none=True)
type = fields.String()
task_param_definitions = fields.Nested(TaskDefinitionParamSchema, many=True)
@post_load
def make_task_definition(self, data, **kwargs):
save_external_links_schema = SaveExternalLinksSchema()
class LogMetricSchema(_ApiCallSchema):
task_run_attempt_uid = fields.UUID(required=True)
metric = fields.Nested(MetricSchema, allow_none=True)
source = fields.String(allow_none=True)
log_metric_schema = LogMetricSchema()
class LogArtifactSchema(_ApiCallSchema):
task_run_attempt_uid = fields.UUID(required=True)
name = fields.String()
path = fields.String()
log_artifact_schema = LogArtifactSchema()
@attr.s
class LogTargetArgs(object):
run_uid = attr.ib() # type: UUID
task_run_uid = attr.ib() # type: UUID
task_run_name = attr.ib() # type: str
task_run_attempt_uid = attr.ib() # type: UUID
target_path = attr.ib() # type: str
param_name = attr.ib() # type: str
task_def_uid = attr.ib() # type: UUID
operation_type = attr.ib() # type: DbndTargetOperationType
save_external_links_schema = SaveExternalLinksSchema()
class LogMetricSchema(_ApiCallSchema):
task_run_attempt_uid = fields.UUID(required=True)
metric = fields.Nested(MetricSchema, allow_none=True)
source = fields.String(allow_none=True)
log_metric_schema = LogMetricSchema()
class LogArtifactSchema(_ApiCallSchema):
task_run_attempt_uid = fields.UUID(required=True)
name = fields.String()
path = fields.String()
log_artifact_schema = LogArtifactSchema()
@attr.s
class LogTargetArgs(object):
run_uid = attr.ib() # type: UUID
task_run_uid = attr.ib() # type: UUID
task_run_name = attr.ib() # type: str
task_run_attempt_uid = attr.ib() # type: UUID
target_path = attr.ib() # type: str
param_name = attr.ib() # type: str
task_def_uid = attr.ib() # type: UUID
operation_type = attr.ib() # type: DbndTargetOperationType
operation_status = attr.ib() # type: DbndTargetOperationStatus
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):
return AirflowServerInfo(**data)
airflow_server_info_schema = AirflowServerInfoSchema()
@attr.s
source = fields.String(allow_none=True)
source_hash = fields.String(allow_none=True)
type = fields.String()
task_param_definitions = fields.Nested(TaskDefinitionParamSchema, many=True)
@post_load
def make_task_definition(self, data, **kwargs):
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()
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)
state = EnumField(RunState)
start_time = fields.DateTime()
end_time = fields.DateTime(allow_none=True)
# deprecate
dag_id = fields.String()
cmd_name = fields.String(allow_none=True)
execution_date = fields.DateTime()
# move to task
target_date = fields.Date(allow_none=True)
version = fields.String(allow_none=True)
driver_name = fields.String()
class TaskDefinitionInfoSchema(ApiObjectSchema):
task_definition_uid = fields.UUID()
name = fields.String()
class_version = fields.String()
family = fields.String()
module_source = fields.String(allow_none=True)
module_source_hash = fields.String(allow_none=True)
source = fields.String(allow_none=True)
source_hash = fields.String(allow_none=True)
type = fields.String()
task_param_definitions = fields.Nested(TaskDefinitionParamSchema, many=True)
@post_load
def make_task_definition(self, data, **kwargs):
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)