jobrunner

package module
Version: v0.0.0-...-7cdd92f Latest Latest
Warning

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

Go to latest
Published: Mar 29, 2019 License: Apache-2.0 Imports: 8 Imported by: 0

README

Coverage Status Build Status GoDoc Go Report Card

Documentation

Overview

Package jobrunner provides higher-level abstraction of automation cloud API which allows to use protocol in order to automate in-flow input requests

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GenerateData

func GenerateData(jibUrl string, config JibConfig, client *http.Client) (data map[string]interface{}, err error)

GenerateData generates input for a job.

Types

type JibConfig

type JibConfig = map[string]interface{}

JibConfig is a configuration for job input bundler (JIB).

type JobRun

type JobRun struct {
	ServiceId        string    `json:"serviceId"`
	DomainId         string    `json:"domainId"`
	JibConfig        JibConfig `json:"jibConfig"`
	CallbackUrl      string    `json:"callbackUrl,omitempty"`
	OversupplyInputs bool      `json:"oversupplyInputs"`
	HowMany          int       `json:"howMany"`
}

JobRun is an instruction required to run a job using JobRunner, options are: - ServiceId: id of automation service, required - DomainId: id of domain, required - JibConfig: job input bundler (jib) configuration, required - CallbackUrl: callback url for webhook - HowMany: how many jobs with the same input data to run (used to test concurrency), defaults to 1

type JobRunner

type JobRunner struct {
	DomainId  string
	Job       *cl.Job
	JibUrl    string `json:"jibUrl"`
	InputData map[string]interface{}
	// contains filtered or unexported fields
}

JobRunner manages job.

func NewRunner

func NewRunner(httpClient *http.Client, apiKey, baseUrl, jibUrl string) JobRunner

NewRunner create a new JobRunner.

func (*JobRunner) CreateInput

func (jr *JobRunner) CreateInput() (err error)

CreateInput makes an attempt to create input automatically. It uses job output and domain type definitions in order to do so. For example, it can send "finalPriceConsent" based on "finalPrice" output, if domain defines "finalPriceConsent" input with "finalPrice" as `sourceOutputKey` and "Consent" and `inputMethod`

func (*JobRunner) ResumeJob

func (jr *JobRunner) ResumeJob(jobId, domainId string) (err error)

ResumeJob initializes jobrunner instance with running job.

func (*JobRunner) RunJob

func (jr *JobRunner) RunJob(jobRun JobRun) (job cl.Job, err error)

RunJob create automation job which then will be stored in JobRunner object for further control.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
t or T : Toggle theme light dark auto
y or Y : Canonical URL