jr

package
v1.0.12 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 6, 2020 License: Apache-2.0 Imports: 7 Imported by: 0

README

Job Runner API

TODO: Fill this out

Running the Code

  1. Update the import path of your jobs in spincycle/job/external/factory
  2. In the root spincycle directory, run go get ./...
  3. Run the JR web server: go run spincycle/job-runner/main.go
  4. Send commands to the web server:
# POST a new chain
curl -H "Content-Type: application/json" -X POST -d '<CHAIN_PAYLOAD>' localhost:9999/api/v1/job-chains

# PUT a chain that is running to start it
curl -X PUT localhost:9999/api/v1/job-chains/<REQUEST_ID_OF_THE_CHAIN>/start

# PUT a chain that is running to stop it
curl -X PUT localhost:9999/api/v1/job-chains/<REQUEST_ID_OF_THE_CHAIN>/stop

# GET the status of a running chain
curl localhost:9999/api/v1/job-chains/<REQUEST_ID_OF_THE_CHAIN>/status

TODOs

  • When a traverser finishes, it should POST back to the Request Manager API the final status of the chain.
  • Make basic things configurable (ex: port for http server).
  • Simplify http routing stuff.

Documentation

Overview

Package client provides an HTTP client for interacting with the Job Runner (JR) API.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client interface {
	// NewJobChain takes a job chain, and sends it to the JR to be run immediately.
	// It returns the URL of the running job chain.
	NewJobChain(baseURL string, jobChain proto.JobChain) (*url.URL, error)
	// ResumeJobChain takes a suspended job chain and sends it to the JR to be
	// resumed. It returns the URL of the running job chain.
	ResumeJobChain(baseURL string, sjc proto.SuspendedJobChain) (*url.URL, error)
	// StopRequest stops the job chain that corresponds to a given request Id. The
	// baseURL should point to the Job Runner running this request.
	StopRequest(baseURL string, requestId string) error

	// Running reports running jobs. If no filters, all requests and jobs are reported.
	Running(baseURL string, f proto.StatusFilter) ([]proto.JobStatus, error)
}

A Client is an HTTP client used for interacting with the JR API.

func NewClient

func NewClient(c *http.Client) Client

NewClient takes an http.Client and base API URL and creates a Client.

Directories

Path Synopsis
Package api provides controllers for each api endpoint.
Package api provides controllers for each api endpoint.
Package chain implements a job chain.
Package chain implements a job chain.
Package runner implements running a job.
Package runner implements running a job.
Package server bootstraps and runs the Job Runner.
Package server bootstraps and runs the Job Runner.
Package status provides system-wide status.
Package status provides system-wide status.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL