Exemplo n.º 1
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'],
    })
Exemplo n.º 2
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'},
            '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
    })
Exemplo n.º 3
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'],
    })
Exemplo n.º 4
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
    })
Exemplo n.º 5
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']
    })
Exemplo n.º 6
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']
    })