{"swagger":"2.0","info":{"title":"svc-sundial","description":"A service for scheduling and running Docker-based jobs","version":"2.0.0-dev"},"consumes":["application/json"],"produces":["application/json"],"paths":{"/_internal_/metrics":{"get":{"parameters":[],"responses":{"200":{"description":"200 response","schema":{"$ref":"#/definitions/string"}}}}},"/api/processes/":{"get":{"description":"Retrieves a list of process runs based on search parameters.","parameters":[{"name":"process_definition_name","in":"query","required":false,"type":"string"},{"name":"start_time","in":"query","required":false,"type":"string","format":"date-time"},{"name":"end_time","in":"query","required":false,"type":"string","format":"date-time"},{"name":"max_records","in":"query","required":false,"type":"integer","format":"int32"},{"name":"allowed_statuses","in":"query","required":true}],"responses":{"200":{"description":"200 response","schema":{"type":"array","items":{"$ref":"#/definitions/process"}}}}}},"/api/processes/{process_id}":{"get":{"description":"Retrieves a process run","parameters":[{"name":"process_id","in":"path","required":true,"type":"string","format":"uuid"}],"responses":{"200":{"description":"200 response","schema":{"$ref":"#/definitions/process"}}}}},"/api/processes/{process_id}/retry":{"post":{"description":"Retries a failed process run by restarting failed tasks; tasks will be given a single additional attempt","parameters":[{"name":"process_id","in":"path","required":true,"type":"string","format":"uuid"}],"responses":{"204":{"description":"204 response"}}}},"/api/processes/{process_id}/kill":{"post":{"description":"Terminates an active process","parameters":[{"name":"process_id","in":"path","required":true,"type":"string","format":"uuid"}],"responses":{"204":{"description":"204 response"}}}},"/api/process_definitions/":{"get":{"description":"Get all currently registered process definitions","parameters":[],"responses":{"200":{"description":"200 response","schema":{"type":"array","items":{"$ref":"#/definitions/process_definition"}}}}}},"/api/process_definitions/{process_definition_name}":{"get":{"description":"Get a registered process definition","parameters":[{"name":"process_definition_name","in":"path","required":true,"type":"string"}],"responses":{"200":{"description":"200 response","schema":{"$ref":"#/definitions/process_definition"}}}},"put":{"description":"Updates or creates a process definition","parameters":[{"name":"process_definition_name","in":"path","required":true,"type":"string"},{"name":"process_definition","in":"body","schema":{"$ref":"#/definitions/process_definition"}}],"responses":{"200":{"description":"200 response","schema":{"$ref":"#/definitions/process_definition"}}}},"delete":{"description":"Deletes a registered process definition","parameters":[{"name":"process_definition_name","in":"path","required":true,"type":"string"}],"responses":{"204":{"description":"204 response"}}}},"/api/process_definitions/{process_definition_name}/trigger":{"post":{"description":"Triggers a new instance of the process","parameters":[{"name":"process_definition_name","in":"path","required":true,"type":"string"},{"name":"task_definition_name","in":"query","required":false,"type":"string"}],"responses":{"204":{"description":"204 response"}}}},"/api/process_definitions/{process_definition_name}/pause":{"post":{"description":"Pause the process schedule","parameters":[{"name":"process_definition_name","in":"path","required":true,"type":"string"}],"responses":{"204":{"description":"204 response"}}}},"/api/process_definitions/{process_definition_name}/resume":{"post":{"description":"Resume the process schedule","parameters":[{"name":"process_definition_name","in":"path","required":true,"type":"string"}],"responses":{"204":{"description":"204 response"}}}},"/api/tasks/":{"get":{"description":"Retrieves the most recent tasks meeting the given criteria","parameters":[{"name":"process_definition_name","in":"query","required":true,"type":"string"},{"name":"task_definition_name","in":"query","required":true,"type":"string"},{"name":"allowed_statuses","in":"query","required":true},{"name":"start_time","in":"query","required":false,"type":"string","format":"date-time"},{"name":"end_time","in":"query","required":false,"type":"string","format":"date-time"},{"name":"limit","in":"query","required":false,"type":"integer","format":"int32"}],"responses":{"200":{"description":"200 response","schema":{"type":"array","items":{"$ref":"#/definitions/task"}}}}}},"/api/tasks/{task_id}/log_entries":{"post":{"description":"Appends log entries for a task; intended for use within the task executable","parameters":[{"name":"task_id","in":"path","required":true,"type":"string","format":"uuid"},{"name":"[log_entry]","in":"body","schema":{"type":"array","items":{"$ref":"#/definitions/log_entry"}}}],"responses":{"204":{"description":"204 response"}}}},"/api/tasks/{task_id}/metadata":{"post":{"description":"Appends metadata entries for a task; intended for use within the task executable","parameters":[{"name":"task_id","in":"path","required":true,"type":"string","format":"uuid"},{"name":"[metadata_entry]","in":"body","schema":{"type":"array","items":{"$ref":"#/definitions/metadata_entry"}}}],"responses":{"204":{"description":"204 response"}}}},"/api/tasks/{task_id}/succeed":{"post":{"description":"Marks the task as having succeeded","parameters":[{"name":"task_id","in":"path","required":true,"type":"string","format":"uuid"}],"responses":{"204":{"description":"204 response"}}}},"/api/tasks/{task_id}/fail":{"post":{"description":"Marks the task as having failed","parameters":[{"name":"task_id","in":"path","required":true,"type":"string","format":"uuid"}],"responses":{"204":{"description":"204 response"}}}}},"definitions":{"batch_image_command":{"type":"object","title":"batch_image_command","required":["image","tag","command","memory","vCpus","environment_variables"],"properties":{"image":{"description":"Name of docker image including registry URL if needed","type":"string"},"tag":{"description":"Tag on docker image","default":"latest","type":"string"},"command":{"description":"Command to pass to Docker container","type":"array","items":{"type":"string"}},"memory":{"type":"integer","format":"int32"},"vCpus":{"type":"integer","format":"int32"},"job_role_arn":{"description":"ARN of an IAM role, see http://docs.aws.amazon.com/AmazonECS/latest/developerguide/task-iam-roles.html","type":"string"},"environment_variables":{"type":"array","items":{"$ref":"#/definitions/environment_variable"}},"job_queue":{"description":"Override default job queue, eg: for priority queue or GPU instances queue","type":"string"}}},"continuous_schedule":{"type":"object","title":"continuous_schedule","properties":{"buffer_seconds":{"description":"The minimum amount of time (in seconds) that must pass between executions of the process","type":"integer","format":"int32"}}},"cron_schedule":{"type":"object","description":"See http://quartz-scheduler.org/api/2.2.0/org/quartz/CronExpression.html","title":"cron_schedule","required":["day_of_week","month","day_of_month","hours","minutes"],"properties":{"day_of_week":{"type":"string"},"month":{"type":"string"},"day_of_month":{"type":"string"},"hours":{"type":"string"},"minutes":{"type":"string"}}},"custom_emr_job_flow_role":{"type":"object","description":"Custom, preconfigured, EMR EC2 instance role","title":"custom_emr_job_flow_role","required":["role_name"],"properties":{"role_name":{"type":"string"}}},"custom_emr_service_role":{"type":"object","description":"Custom, preconfigured, EMR Service role","title":"custom_emr_service_role","required":["role_name"],"properties":{"role_name":{"type":"string"}}},"email":{"type":"object","description":"An email to send notifications to","title":"email","required":["name","email","notify_when"],"properties":{"name":{"type":"string"},"email":{"type":"string"},"notify_when":{"type":"string","enum":["always","on_failure","on_state_change","on_state_change_and_failures","never"]}}},"emr_command":{"type":"object","title":"emr_command","required":["emr_cluster","job_name","region","class","s3_jar_path","spark_conf","spark_packages","args"],"properties":{"emr_cluster":{"$ref":"#/definitions/emr_cluster"},"job_name":{"description":"NAme to be assigned to the Job","type":"string"},"region":{"description":"the AWS Region","default":"us-east-1","type":"string"},"class":{"description":"The spark job's `Main.class` to run","example":"org.apache.spark.examples.SparkPi","type":"string"},"s3_jar_path":{"description":"the s3 path to the jar of the job to be run","example":"s3://my-emr-source-bucket/my-emr-jar.jar","type":"string"},"spark_conf":{"description":"options that will be sent to spark as --conf key=value, e.g. `--conf spark.driver.extraJavaOptions=-Denvironment=integration`","example":"[\"spark.driver.extraJavaOptions=-Denvironment=integration\"]","type":"array","items":{"type":"string"}},"spark_packages":{"type":"array","items":{"$ref":"#/definitions/maven_package"}},"args":{"description":"command line arguments to be passe to the job's main class","example":"[\"--executor-memory\", \"1g\"]","type":"array","items":{"type":"string"}},"s3_log_details":{"$ref":"#/definitions/s3_log_details"},"load_data":{"type":"array","items":{"$ref":"#/definitions/s3_cp"}},"save_results":{"type":"array","items":{"$ref":"#/definitions/s3_cp"}}}},"emr_configuration":{"type":"object","description":"See https://docs.aws.amazon.com/emr/latest/ReleaseGuide/emr-configure-apps.html","title":"emr_configuration","properties":{"classification":{"type":"string"},"configurations":{"type":"array","items":{"$ref":"#/definitions/emr_configuration"}},"properties":{"$ref":"#/definitions/map[string]"}}},"emr_instance_group_details":{"type":"object","description":"Additional configuration for Master/Core/Task EMR instance Groups.","title":"emr_instance_group_details","required":["emr_instance_type","instance_count","aws_market"],"properties":{"emr_instance_type":{"type":"string"},"instance_count":{"type":"integer","format":"int32"},"aws_market":{"$ref":"#/definitions/aws_market"},"ebs_volume_size":{"description":"optional EBS volume in GB to attach to the emr instance, for simplicity only one volume for the given size and type gp2 will be created.","type":"integer","format":"int32"}}},"environment_variable":{"type":"object","title":"environment_variable","required":["variable_name","value"],"properties":{"variable_name":{"type":"string"},"value":{"type":"string"}}},"existing_emr_cluster":{"type":"object","description":"Existing EMR cluster configuration object","title":"existing_emr_cluster","required":["cluster_id"],"properties":{"cluster_id":{"description":"The EMR cluster id","example":"j-2CRR69WTM7N31","type":"string"}}},"healthcheck":{"type":"object","title":"healthcheck","required":["status"],"properties":{"status":{"type":"string"}}},"log_entry":{"type":"object","title":"log_entry","required":["log_entry_id","when","source","message"],"properties":{"log_entry_id":{"description":"Uniquely identifies the log message to prevent duplication","type":"string","format":"uuid"},"when":{"type":"string","format":"date-time"},"source":{"type":"string"},"message":{"type":"string"}}},"maven_package":{"type":"object","title":"maven_package","required":["group_id","artifact_id","version"],"properties":{"group_id":{"type":"string"},"artifact_id":{"type":"string"},"version":{"type":"string"}}},"metadata_entry":{"type":"object","title":"metadata_entry","required":["metadata_entry_id","when","key","value"],"properties":{"metadata_entry_id":{"description":"Uniquely identifies the metadata entry to prevent duplication","type":"string","format":"uuid"},"when":{"type":"string","format":"date-time"},"key":{"type":"string"},"value":{"type":"string"}}},"new_emr_cluster":{"type":"object","description":"New EMR cluster configuration object","title":"new_emr_cluster","required":["name","release_label","applications","s3_log_uri","master_instance","emr_service_role","emr_job_flow_role","visible_to_all_users"],"properties":{"name":{"type":"string"},"release_label":{"type":"string","enum":["emr-5.20.0","emr-5.19.0","emr-5.18.0","emr-5.17.0","emr-5.16.0","emr-5.15.0","emr-5.14.0","emr-5.13.0","emr-5.12.1","emr-5.12.0","emr-5.11.1","emr-5.11.0","emr-5.10.0","emr-5.9.0","emr-4.9.2","emr-4.9.1"]},"applications":{"type":"array","items":{"type":"string","enum":["Hadoop","Hive","Mahout","Pig","Spark","Ganglia"]}},"s3_log_uri":{"type":"string"},"master_instance":{"$ref":"#/definitions/emr_instance_group_details"},"core_instance":{"$ref":"#/definitions/emr_instance_group_details"},"task_instance":{"$ref":"#/definitions/emr_instance_group_details"},"ec2_subnet":{"description":"To be set in case the EMR cannot be launched in the `default VPC`","type":"string"},"emr_service_role":{"$ref":"#/definitions/emr_service_role"},"emr_job_flow_role":{"$ref":"#/definitions/emr_job_flow_role"},"visible_to_all_users":{"description":"whether or not to show the new cluster in the list of clusters. For more details see [emr docs](http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-emr-cluster.html#cfn-emr-cluster-visibletoallusers)","default":"false","type":"boolean"},"configurations":{"type":"array","items":{"$ref":"#/definitions/emr_configuration"}},"security_configuration":{"description":"Allow you to specify a security configuration for the cluster","type":"string"}}},"pagerduty":{"type":"object","description":"Pager Duty integration","title":"pagerduty","required":["service_key","num_consecutive_failures","api_url"],"properties":{"service_key":{"type":"string"},"num_consecutive_failures":{"default":"1","type":"integer","format":"int32"},"api_url":{"default":"https://events.pagerduty.com","type":"string"}}},"process":{"type":"object","title":"process","required":["process_id","process_definition_name","start_time","status","task"],"properties":{"process_id":{"type":"string","format":"uuid"},"process_definition_name":{"type":"string"},"start_time":{"type":"string","format":"date-time"},"status":{"type":"string","enum":["running","succeeded","failed"]},"task":{"type":"array","items":{"$ref":"#/definitions/task"}}}},"process_definition":{"type":"object","description":"A grouping of related tasks that are run as a single unit on the same schedule","title":"process_definition","required":["process_definition_name","task_definitions","overlap_action"],"properties":{"process_definition_name":{"type":"string"},"paused":{"description":"If true, ignore schedule and only start process if triggered manually","type":"boolean"},"process_description":{"type":"string"},"schedule":{"$ref":"#/definitions/process_schedule"},"task_definitions":{"type":"array","items":{"$ref":"#/definitions/task_definition"}},"overlap_action":{"type":"string","enum":["wait","terminate"]},"notifications":{"type":"array","items":{"$ref":"#/definitions/notification"}}}},"s3_cp":{"type":"object","description":"Wrapper of the S3DistCp spark job for more info visit the aws [s3-dist-cp](https://docs.aws.amazon.com/emr/latest/ReleaseGuide/UsingEMR_s3distcp.html) page","title":"s3_cp","required":["source","destination"],"properties":{"source":{"description":"Source folder or file to copy. It can be either a s3 or HDFS location","example":"s3:///my-bucket-root - hdfs://tmp/my-temp-folder","type":"string"},"destination":{"description":"Source folder or file to copy. It can be either a s3 or HDFS location","example":"s3:///my-bucket-root - hdfs://tmp/my-temp-folder","type":"string"}}},"s3_log_details":{"type":"object","title":"s3_log_details","required":["log_group_name","log_stream_name"],"properties":{"log_group_name":{"type":"string"},"log_stream_name":{"type":"string"}}},"shell_script_command":{"type":"object","title":"shell_script_command","required":["script"],"properties":{"script":{"type":"string"},"environment_variables":{"type":"array","items":{"$ref":"#/definitions/environment_variable"}}}},"spot":{"type":"object","description":"the maximum spot bid price","title":"spot","required":["bid_price"],"properties":{"bid_price":{"type":"number","format":"float"}}},"task":{"type":"object","title":"task","required":["task_id","process_id","process_definition_name","task_definition_name","start_time","previous_attempt_count","log_entries","metadata_entries","status"],"properties":{"task_id":{"type":"string","format":"uuid"},"process_id":{"type":"string","format":"uuid"},"process_definition_name":{"type":"string"},"task_definition_name":{"type":"string"},"start_time":{"type":"string","format":"date-time"},"end_time":{"type":"string","format":"date-time"},"previous_attempt_count":{"type":"integer","format":"int32"},"log_entries":{"type":"array","items":{"$ref":"#/definitions/log_entry"}},"metadata_entries":{"type":"array","items":{"$ref":"#/definitions/metadata_entry"}},"execution_state":{"type":"array","items":{"$ref":"#/definitions/metadata_entry"}},"status":{"type":"string","enum":["submitted","runnable","starting","pending","running","failed","succeeded"]}}},"task_definition":{"type":"object","description":"An individual task that runs as part of a process","title":"task_definition","required":["task_definition_name","dependencies","executable","max_attempts","backoff_base_seconds","backoff_exponent","require_explicit_success"],"properties":{"task_definition_name":{"description":"The canonical name for this task used by other tasks to identify this task","type":"string"},"dependencies":{"type":"array","items":{"$ref":"#/definitions/task_dependency"}},"executable":{"$ref":"#/definitions/task_executable"},"max_attempts":{"type":"integer","format":"int32"},"max_runtime_seconds":{"description":"The execution time (for a single attempt) after which the system will kill the task","type":"integer","format":"int32"},"backoff_base_seconds":{"type":"integer","format":"int32"},"backoff_exponent":{"default":"1","type":"number","format":"double"},"require_explicit_success":{"description":"If true, the task must explicitly update its status with Sundial in order to succeed.","default":"false","type":"boolean"}}},"task_dependency":{"type":"object","title":"task_dependency","required":["task_definition_name","success_required"],"properties":{"task_definition_name":{"type":"string"},"success_required":{"default":"true","type":"boolean"}}},"aws_market":{"type":"object","description":"The EC2 market of the EC2 instances","title":"aws_market","allOf":[{"type":"string","enum":["on_demand"]},{"$ref":"#/definitions/spot"}]},"emr_cluster":{"type":"object","description":"Whether or not to create a new EMR cluster or re-use a pre-existing one","title":"emr_cluster","allOf":[{"$ref":"#/definitions/new_emr_cluster"},{"$ref":"#/definitions/existing_emr_cluster"}]},"emr_job_flow_role":{"type":"object","description":"The EMR role to use on the EC2 instances","title":"emr_job_flow_role","allOf":[{"type":"string","enum":["default_emr_job_flow_role"]},{"$ref":"#/definitions/custom_emr_job_flow_role"}]},"emr_service_role":{"type":"object","description":"The EMR service role to use","title":"emr_service_role","allOf":[{"type":"string","enum":["default_emr_service_role"]},{"$ref":"#/definitions/custom_emr_service_role"}]},"notification":{"type":"object","title":"notification","allOf":[{"$ref":"#/definitions/email"},{"$ref":"#/definitions/pagerduty"}]},"process_schedule":{"type":"object","description":"A specification for when a process should be run","title":"process_schedule","allOf":[{"$ref":"#/definitions/cron_schedule"},{"$ref":"#/definitions/continuous_schedule"}]},"task_executable":{"type":"object","title":"task_executable","allOf":[{"$ref":"#/definitions/shell_script_command"},{"$ref":"#/definitions/batch_image_command"},{"$ref":"#/definitions/emr_command"}]}}}