예제 #1
0
파일: engine.py 프로젝트: ophiradi/dart
def engine_schema():
    return base_schema({
        'type': 'object',
        'properties': {
            'name': {'type': 'string', 'pattern': '^[a-zA-Z0-9_-]+$', 'maxLength': 50},
            'description': {'type': ['string', 'null']},
            'ecs_task_definition': {'type': ['object', 'null']},
            'ecs_task_definition_arn': {'type': ['string', 'null']},
            'options_json_schema': {'type': ['object', 'null']},
            'supported_action_types': {
                'x-schema-form': {'type': 'tabarray', 'title': "{{ value.name }}"},
                'type': 'array',
                'items': {
                    'type': 'object',
                    'properties': {
                        'name': {'type': 'string'},
                        'description': {'type': 'string'},
                        'params_json_schema': {'type': ['object', 'null']},
                    }
                },
                'minItems': 1,
            },
            'tags': tag_list_schema(),
        },
        'additionalProperties': False,
        'required': ['name']
    })
예제 #2
0
def workflow_schema():
    return base_schema({
        'type': 'object',
        'properties': {
            'name': {'type': 'string', 'pattern': '^[a-zA-Z0-9_-]+$', 'maxLength': 50},
            'datastore_id': {'type': 'string'},
            'engine_name': {'type': ['string', 'null'], 'readonly': True},
            'state': {'type': 'string', 'enum': WorkflowState.all(), 'default': WorkflowState.INACTIVE},
            'concurrency': {'type': 'integer', 'default': 1, 'minimum': 1, 'maximum': 10},
            'on_failure': {
                'type': 'string',
                'enum': OnFailure.all(),
                'default': OnFailure.DEACTIVATE,
                'description': 'applies to the datastore'
            },
            'on_failure_email': email_list_schema(),
            'on_success_email': email_list_schema(),
            'on_started_email': email_list_schema(),
            'retries_on_failure': {'type': 'integer', 'default': 0, 'minimum': 0},
            'tags': tag_list_schema(),
            'avg_runtime': {'type': ['string', 'null'], 'readonly': True},
        },
        'additionalProperties': False,
        'required': ['name', 'datastore_id'],
    })
예제 #3
0
파일: action.py 프로젝트: chrisborg/dart
def action_schema(supported_action_type_params_schema):
    default_required = ['action_type_name', 'engine_name', 'name']
    return base_schema({
        'type': 'object',
        'properties': {
            'name': {'type': 'string', 'pattern': '^[a-zA-Z0-9_-]+$', 'maxLength': 50},
            'action_type_name': {'type': 'string', 'readonly': True},
            'args': supported_action_type_params_schema or {'type': 'null'},
            'state': {'type': 'string', 'enum': ActionState.all(), 'default': ActionState.HAS_NEVER_RUN},
            'tags': tag_list_schema(),
            'queued_time': {'type': ['string', 'null'], 'readonly': True},
            'start_time': {'type': ['string', 'null'], 'readonly': True},
            'end_time': {'type': ['string', 'null'], 'readonly': True},
            'progress': {'type': ['number', 'null'], 'readonly': True},
            'order_idx': {'type': ['number', 'null'], 'minimum': 0.0},
            'error_message': {'type': ['string', 'null'], 'readonly': True, "x-schema-form": {"type": "textarea"}},
            'on_failure': {'type': 'string', 'enum': OnFailure.all(), 'default': OnFailure.DEACTIVATE},
            'on_failure_email': email_list_schema(),
            'on_success_email': email_list_schema(),
            'engine_name': {'type': 'string', 'readonly': True},
            'datastore_id': {'type': ['string', 'null'], 'default': None},
            'workflow_id': {'type': ['string', 'null'], 'default': None},
            'workflow_instance_id': {'type': ['string', 'null'], 'default': None, 'readonly': True},
            'workflow_action_id': {'type': ['string', 'null'], 'default': None, 'readonly': True},
            'first_in_workflow': {'type': ['boolean', 'null'], 'default': False, 'readonly': True},
            'last_in_workflow': {'type': ['boolean', 'null'], 'default': False, 'readonly': True},
            'ecs_task_arn': {'type': ['string', 'null'], 'default': None, 'readonly': True},
            'extra_data': {'type': ['object', 'null'], 'default': None, 'readonly': True},
        },
        'additionalProperties': False,
        'required': default_required + ['args'] if supported_action_type_params_schema else default_required
    })
예제 #4
0
파일: engine.py 프로젝트: ophiradi/dart
def subgraph_definition_schema(trigger_schemas, action_schemas, datastore_schema):
    return base_schema({
        'type': 'object',
        'properties': {
            'name': {'type': 'string'},
            'description': {'type': 'string'},
            'engine_name': {'type': 'string'},
            'related_type': {'type': 'string', 'maxLength': 50},
            'related_is_a': {'type': 'string', 'maxLength': 50},
            'actions': {
                'x-schema-form': {'type': 'tabarray', 'title': "{{ value.name }}"},
                'type': 'array',
                'items': {'anyOf': action_schemas},
                'default': []
            },
            'datastores': {
                'x-schema-form': {'type': 'tabarray', 'title': "{{ value.name }}"},
                'type': 'array',
                'items': datastore_schema,
                'default': []
            },
            'datasets': {
                'x-schema-form': {'type': 'tabarray', 'title': "{{ value.name }}"},
                'type': 'array',
                'items': dataset_schema(),
                'default': []
            },
            'events': {
                'x-schema-form': {'type': 'tabarray', 'title': "{{ value.name }}"},
                'type': 'array',
                'items': event_schema(),
                'default': []
            },
            'subscriptions': {
                'x-schema-form': {'type': 'tabarray', 'title': "{{ value.name }}"},
                'type': 'array',
                'items': subscription_schema(),
                'default': []
            },
            'triggers': {
                'x-schema-form': {'type': 'tabarray', 'title': "{{ value.name }}"},
                'type': 'array',
                'items': {'anyOf': trigger_schemas},
                'default': []
            },
            'workflows': {
                'x-schema-form': {'type': 'tabarray', 'title': "{{ value.name }}"},
                'type': 'array',
                'items': workflow_schema(),
                'default': []
            },
            'icon': {'type': ['string', 'null']},
            'md_icon': {'type': ['string', 'null']},
        },
        'additionalProperties': False,
        'required': ['name', 'engine_name', 'related_type', 'related_is_a']
    })
예제 #5
0
def event_schema():
    return base_schema({
        'type': 'object',
        'properties': {
            'name': {'type': 'string', 'pattern': '^[a-zA-Z0-9_-]+$', 'maxLength': 50},
            'description': {'type': ['string', 'null']},
            'state': {'type': 'string', 'enum': EventState.all(), 'default': EventState.INACTIVE},
            'tags': tag_list_schema(),
        },
        'additionalProperties': False,
        'required': ['name']
    })
예제 #6
0
def workflow_instance_schema():
    return base_schema({
        'type': 'object',
        'readonly': True,
        'properties': {
            'workflow_id': {
                'type': 'string'
            },
            'datastore_id': {
                'type': 'string'
            },
            'engine_name': {
                'type': 'string'
            },
            'state': {
                'type': 'string',
                'enum': WorkflowInstanceState.all(),
                'default': WorkflowInstanceState.QUEUED
            },
            'trigger_type': {
                'type': 'string'
            },
            'trigger_id': {
                'type': ['string', 'null']
            },
            'queued_time': {
                'type': ['string', 'null']
            },
            'start_time': {
                'type': ['string', 'null']
            },
            'end_time': {
                'type': ['string', 'null']
            },
            'retry_num': {
                'type': 'integer',
                'default': 0,
                'minimum': 0,
                'readonly': True
            },
            'error_message': {
                'type': ['string', 'null'],
                'readonly': True,
                "x-schema-form": {
                    "type": "textarea"
                }
            },
            'tags': tag_list_schema(),
        },
        'additionalProperties': False,
        'required': [],
    })
예제 #7
0
def workflow_schema():
    return base_schema({
        'type': 'object',
        'properties': {
            'name': {
                'type': 'string',
                'pattern': '^[a-zA-Z0-9_-]+$',
                'maxLength': 50
            },
            'datastore_id': {
                'type': 'string'
            },
            'engine_name': {
                'type': ['string', 'null'],
                'readonly': True
            },
            'state': {
                'type': 'string',
                'enum': WorkflowState.all(),
                'default': WorkflowState.INACTIVE
            },
            'concurrency': {
                'type': 'integer',
                'default': 1,
                'minimum': 1,
                'maximum': 10
            },
            'on_failure': {
                'type': 'string',
                'enum': OnFailure.all(),
                'default': OnFailure.DEACTIVATE,
                'description': 'applies to the datastore'
            },
            'on_failure_email': email_list_schema(),
            'on_success_email': email_list_schema(),
            'on_started_email': email_list_schema(),
            'retries_on_failure': {
                'type': 'integer',
                'default': 0,
                'minimum': 0
            },
            'tags': tag_list_schema(),
            'avg_runtime': {
                'type': ['string', 'null'],
                'readonly': True
            },
        },
        'additionalProperties': False,
        'required': ['name', 'datastore_id'],
    })
예제 #8
0
파일: workflow.py 프로젝트: chrisborg/dart
def workflow_instance_schema():
    return base_schema({
        'type': 'object',
        'readonly': True,
        'properties': {
            'workflow_id': {'type': 'string'},
            'datastore_id': {'type': 'string'},
            'engine_name': {'type': 'string'},
            'state': {'type': 'string', 'enum': WorkflowInstanceState.all(), 'default': WorkflowInstanceState.QUEUED},
            'trigger_type': {'type': 'string'},
            'trigger_id': {'type': 'string'},
            'queued_time': {'type': ['string', 'null']},
            'start_time': {'type': ['string', 'null']},
            'end_time': {'type': ['string', 'null']},
            'error_message': {'type': ['string', 'null'], 'readonly': True, "x-schema-form": {"type": "textarea"}},
            'tags': tag_list_schema(),
        },
        'additionalProperties': False,
    })
예제 #9
0
def action_schema(supported_action_type_params_schema):
    default_required = ['action_type_name', 'engine_name', 'name']
    return base_schema({
        'type': 'object',
        'properties': {
            'name': {'type': 'string', 'pattern': '^[a-zA-Z0-9_-]+$', 'maxLength': 50},
            'action_type_name': {'type': 'string', 'readonly': True},
            'args': supported_action_type_params_schema or {'type': ['null', 'object'], 'additionalProperties': False, 'properties': {}},
            'state': {'type': 'string', 'enum': ActionState.all(), 'default': ActionState.HAS_NEVER_RUN},
            'tags': tag_list_schema(),
            'queued_time': {'type': ['string', 'null'], 'readonly': True},
            'start_time': {'type': ['string', 'null'], 'readonly': True},
            'end_time': {'type': ['string', 'null'], 'readonly': True},
            'progress': {'type': ['number', 'null'], 'readonly': True},
            'order_idx': {'type': ['number', 'null'], 'minimum': 0.0},
            'parallelization_idx': {'type': ['number', 'null'], 'minimum': 0.0},
            'error_message': {'type': ['string', 'null'], 'readonly': True, "x-schema-form": {"type": "textarea"}},
            'on_failure': {
                'type': 'string',
                'enum': OnFailure.all(),
                'default': OnFailure.DEACTIVATE,
                'description': 'applies to the workflow if this is a workflow action template, otherwise the datastore'
            },
            'on_failure_email': email_list_schema(),
            'on_success_email': email_list_schema(),
            'engine_name': {'type': 'string', 'readonly': True},
            'datastore_id': {'type': ['string', 'null'], 'default': None},
            'workflow_id': {'type': ['string', 'null'], 'default': None},
            'workflow_instance_id': {'type': ['string', 'null'], 'default': None, 'readonly': True},
            'workflow_action_id': {'type': ['string', 'null'], 'default': None, 'readonly': True},
            'first_in_workflow': {'type': ['boolean', 'null'], 'default': False, 'readonly': True},
            'last_in_workflow': {'type': ['boolean', 'null'], 'default': False, 'readonly': True},
            'ecs_task_arn': {'type': ['string', 'null'], 'default': None, 'readonly': True},
            'batch_job_id': {'type': ['string', 'null'], 'default': None, 'readonly': True},
            'extra_data': {'type': ['object', 'null'], 'default': None, 'readonly': True},
            'avg_runtime': {'type': ['string', 'null'], 'readonly': True},
            'completed_runs': {'type': 'integer', 'default': 0, 'readonly': True}
        },
        'additionalProperties': False,
        'required': default_required + ['args'] if supported_action_type_params_schema else default_required
    })
예제 #10
0
def trigger_schema(trigger_params_schema):
    return base_schema({
        'type': 'object',
        'properties': {
            'name': {'type': 'string', 'pattern': '^[a-zA-Z0-9_-]+$', 'maxLength': 50},
            'trigger_type_name': {'type': 'string', 'readonly': True},
            'workflow_ids': {
                'x-schema-form': {'type': 'tabarray', 'title': "{{ value || 'workflow_id ' + $index }}"},
                'type': 'array',
                'default': [],
                'items': {'type': 'string'},
                'minItems': 0,
            },
            'tags': tag_list_schema(),
            'args': trigger_params_schema or {'type': 'null'},
            'state': {'type': 'string', 'enum': TriggerState.all(), 'default': TriggerState.INACTIVE},
            'extra_data': {'type': ['object', 'null'], 'default': None, 'readonly': True},
        },
        'additionalProperties': False,
        'required': ['name', 'trigger_type_name', 'args'] if trigger_params_schema else ['name', 'trigger_type_name']
    })
예제 #11
0
def datastore_schema(engine_data_options_schema):
    return base_schema({
        'type': 'object',
        'properties': {
            'name': {'type': 'string', 'pattern': '^[a-zA-Z0-9_-]+$', 'maxLength': 50},
            'engine_name': {'type': 'string', 'pattern': '^[a-zA-Z0-9_]+$', 'readonly': True},
            'workflow_datastore_id': {'type': ['string', 'null'], 'default': None, 'readonly': True},
            'host': {'type': ['string', 'null'], 'default': None, 'readonly': True},
            'port': {'type': ['integer', 'null'], 'default': None, 'readonly': True},
            'connection_url': {'type': ['string', 'null'], 'default': None, 'readonly': True},
            's3_artifacts_path': {'type': ['string', 'null'], 'default': None, 'readonly': True},
            's3_logs_path': {'type': ['string', 'null'], 'default': None, 'readonly': True},
            'tags': tag_list_schema(),
            'state': {'type': 'string', 'enum': DatastoreState.all(), 'default': DatastoreState.INACTIVE},
            'concurrency': {'type': 'integer', 'default': 1, 'minimum': 1, 'maximum': 10},
            'args': engine_data_options_schema or {'type': 'null'},
            'extra_data': {'type': ['object', 'null'], 'default': None, 'readonly': True},
        },
        'additionalProperties': False,
        'required': ['name', 'engine_name', 'args'] if engine_data_options_schema else ['name', 'engine_name']
    })
예제 #12
0
def event_schema():
    return base_schema({
        'type': 'object',
        'properties': {
            'name': {
                'type': 'string',
                'pattern': '^[a-zA-Z0-9_-]+$',
                'maxLength': 50
            },
            'description': {
                'type': ['string', 'null']
            },
            'state': {
                'type': 'string',
                'enum': EventState.all(),
                'default': EventState.INACTIVE
            },
            'tags': tag_list_schema(),
        },
        'additionalProperties': False,
        'required': ['name']
    })
예제 #13
0
def subscription_schema():
    return base_schema({
        'type': 'object',
        'properties': {
            'name': {'type': 'string', 'pattern': '^[a-zA-Z0-9_-]+$', 'maxLength': 50},
            'dataset_id': {'type': 'string'},
            'tags': tag_list_schema(),
            's3_path_start_prefix_inclusive': {'type': ['string', 'null'], 'default': None, 'pattern': '^s3://.+$', 'description': 'The inclusive s3 path start prefix'},
            's3_path_end_prefix_exclusive': {'type': ['string', 'null'], 'default': None, 'pattern': '^s3://.+$', 'description': 'The exclusive s3 path end prefix'},
            's3_path_regex_filter': {'type': ['string', 'null'], 'default': None, 'description': 'A regex pattern the s3 path must match'},
            'state': {'type': 'string', 'enum': SubscriptionState.all(), 'default': SubscriptionState.INACTIVE},
            'queued_time': {'type': ['string', 'null'], 'readonly': True},
            'generating_time': {'type': ['string', 'null'], 'readonly': True},
            'initial_active_time': {'type': ['string', 'null'], 'readonly': True},
            'failed_time': {'type': ['string', 'null'], 'readonly': True},
            'message_id': {'type': ['string', 'null'], 'default': None, 'readonly': True},
            'on_failure_email': email_list_schema(),
            'on_success_email': email_list_schema(),
        },
        'additionalProperties': False,
        'required': ['name', 'dataset_id']
    })
예제 #14
0
파일: datastore.py 프로젝트: ophiradi/dart
def datastore_schema(engine_data_options_schema):
    return base_schema({
        'type':
        'object',
        'properties': {
            'name': {
                'type': 'string',
                'pattern': '^[a-zA-Z0-9_-]+$',
                'maxLength': 50
            },
            'engine_name': {
                'type': 'string',
                'pattern': '^[a-zA-Z0-9_]+$',
                'readonly': True
            },
            'workflow_datastore_id': {
                'type': ['string', 'null'],
                'default': None,
                'readonly': True
            },
            'host': {
                'type': ['string', 'null'],
                'default': None,
                'readonly': True
            },
            'port': {
                'type': ['integer', 'null'],
                'default': None,
                'readonly': True
            },
            'connection_url': {
                'type': ['string', 'null'],
                'default': None,
                'readonly': True
            },
            's3_artifacts_path': {
                'type': ['string', 'null'],
                'default': None,
                'readonly': True
            },
            's3_logs_path': {
                'type': ['string', 'null'],
                'default': None,
                'readonly': True
            },
            'tags': tag_list_schema(),
            'state': {
                'type': 'string',
                'enum': DatastoreState.all(),
                'default': DatastoreState.INACTIVE
            },
            'concurrency': {
                'type': 'integer',
                'default': 1,
                'minimum': 1,
                'maximum': 10
            },
            'args': engine_data_options_schema or {
                'type': 'null'
            },
            'extra_data': {
                'type': ['object', 'null'],
                'default': None,
                'readonly': True
            },
        },
        'additionalProperties':
        False,
        'required': ['name', 'engine_name', 'args']
        if engine_data_options_schema else ['name', 'engine_name']
    })
예제 #15
0
def subscription_schema():
    return base_schema({
        'type': 'object',
        'properties': {
            'name': {
                'type': 'string',
                'pattern': '^[a-zA-Z0-9_-]+$',
                'maxLength': 50
            },
            'dataset_id': {
                'type': 'string'
            },
            'tags': tag_list_schema(),
            's3_path_start_prefix_inclusive': {
                'type': ['string', 'null'],
                'default': None,
                'pattern': '^s3://.+$',
                'description': 'The inclusive s3 path start prefix'
            },
            's3_path_end_prefix_exclusive': {
                'type': ['string', 'null'],
                'default': None,
                'pattern': '^s3://.+$',
                'description': 'The exclusive s3 path end prefix'
            },
            's3_path_regex_filter': {
                'type': ['string', 'null'],
                'default': None,
                'description': 'A regex pattern the s3 path must match'
            },
            'state': {
                'type': 'string',
                'enum': SubscriptionState.all(),
                'default': SubscriptionState.INACTIVE
            },
            'queued_time': {
                'type': ['string', 'null'],
                'readonly': True
            },
            'generating_time': {
                'type': ['string', 'null'],
                'readonly': True
            },
            'initial_active_time': {
                'type': ['string', 'null'],
                'readonly': True
            },
            'failed_time': {
                'type': ['string', 'null'],
                'readonly': True
            },
            'message_id': {
                'type': ['string', 'null'],
                'default': None,
                'readonly': True
            },
            'on_failure_email': email_list_schema(),
            'on_success_email': email_list_schema(),
        },
        'additionalProperties': False,
        'required': ['name', 'dataset_id']
    })
예제 #16
0
def dataset_schema():
    return base_schema({
        'type':
        'object',
        'properties': {
            'name': {
                'type': 'string',
                'pattern': '^[a-zA-Z0-9_-]+$',
                'maxLength': 50
            },
            'table_name': {
                'type': 'string',
                'pattern': '^[a-zA-Z0-9_]+$',
                'minLength': 1
            },
            'location': {
                'type': 'string',
                'placeholder': 's3://',
                'pattern': '^s3://.+$'
            },
            'load_type': {
                'type': 'string',
                'enum': LoadType.all()
            },
            'data_format': {
                'type': 'object',
                'properties': {
                    'file_format': {
                        'type': 'string',
                        'enum': FileFormat.all()
                    },
                    'row_format': {
                        'type': 'string',
                        'enum': RowFormat.all()
                    },
                    'num_header_rows': {
                        'type': 'integer',
                        'default': 0,
                        'minimum': 0
                    },
                    'delimited_by': {
                        'type': ['string', 'null'],
                        'default': None
                    },
                    'quoted_by': {
                        'type': ['string', 'null'],
                        'default': None
                    },
                    'escaped_by': {
                        'type': ['string', 'null'],
                        'default': None
                    },
                    'null_string': {
                        'type': ['string', 'null'],
                        'default': None
                    },
                    'regex_input': {
                        'type': ['string', 'null'],
                        'default': None
                    },
                    'regex_output': {
                        'type': ['string', 'null'],
                        'default': None
                    },
                },
                'additionalProperties': False,
                'required': ['file_format', 'row_format']
            },
            'columns': columns_schema(1, False),
            'primary_keys': {
                'type': 'array',
                'default': [],
                'x-schema-form': {
                    'type': 'tabarray',
                    'title': "{{ value || 'primary_key ' + $index }}"
                },
                'items': {
                    'type': 'string',
                    'pattern': '^[a-zA-Z0-9_]+$',
                    'maxLength': 127
                }
            },
            'merge_keys': {
                'type': 'array',
                'default': [],
                'x-schema-form': {
                    'type': 'tabarray',
                    'title': "{{ value || 'merge_key ' + $index }}"
                },
                'items': {
                    'type': 'string',
                    'pattern': '^[a-zA-Z0-9_]+$',
                    'maxLength': 127
                }
            },
            'sort_keys': {
                'type': 'array',
                'default': [],
                'x-schema-form': {
                    'type': 'tabarray',
                    'title': "{{ value || 'sort_key ' + $index }}"
                },
                'items': {
                    'type': 'string',
                    'pattern': '^[a-zA-Z0-9_]+$',
                    'maxLength': 127
                }
            },
            'distribution_keys': {
                'type': 'array',
                'default': [],
                'x-schema-form': {
                    'type': 'tabarray',
                    'title': "{{ value || 'distribution_key ' + $index }}"
                },
                'items': {
                    'type': 'string',
                    'pattern': '^[a-zA-Z0-9_]+$',
                    'maxLength': 127
                }
            },
            'batch_merge_sort_keys': {
                'type': 'array',
                'default': [],
                'x-schema-form': {
                    'type': 'tabarray',
                    'title': "{{ value || 'upsert_sort_key ' + $index }}"
                },
                'items': {
                    'type': 'string',
                    'pattern': '^[a-zA-Z0-9_]+ (ASC|DESC)$',
                    'maxLength': 127
                }
            },
            'tags': tag_list_schema(),
            'compression': {
                'type': 'string',
                'enum': Compression.all()
            },
            'partitions': columns_schema(0, True),
            'hive_compatible_partition_folders': {
                'type': ['boolean', 'null'],
                'default': False
            },
            'description': {
                'type': ['string', 'null'],
                'default': None
            },
        },
        'additionalProperties':
        False,
        'required': [
            'name', 'table_name', 'location', 'load_type', 'data_format',
            'columns', 'compression'
        ]
    })