scheduler

package
v1.2.2-dev.94 Latest Latest
Warning

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

Go to latest
Published: Oct 26, 2020 License: Apache-2.0 Imports: 44 Imported by: 0

README

EdgeX Foundry Support Scheduler Service

Go implementation of EdgeX Support Scheduler.

Installation and Execution

To fetch the code and build the microservice execute the following:

cd $GOPATH/src
go get github.com/edgexfoundry/edgex-go
cd $GOPATH/src/github.com/edgexfoundry/edgex-go
# pull the 3rd party / vendor packages
make prepare
# build the microservice
make cmd/support-scheduler/support-scheduler
# get to the support logging microservice executable
cd cmd/support-scheduler
# run the microservice (may require other dependent services to run correctly)
./support-scheduler

To test, simple run:

cd $GOPATH/src
go get github.com/edgexfoundry/edgex-go
# pull the 3rd party / vendor packages
make prepare
# build the microservice
make cmd/support-scheduler/support-scheduler
# exectute the go test(s)
go test

Install and Deploy via Docker Container

This project has facilities to create and run Docker containers. A Dockerfile is included in the repo. Make sure you have already run make prepare to update the dependecies. To do a Docker build using the included Docker file, run the following:

Prerequisites

See https://docs.docker.com/install/ to learn how to obtain and install Docker.

Installation and Execution
cd $GOPATH/src
go get github.com/edgexfoundry/edgex-go
cd $GOPATH/src/github.com/edgexfoundry/edgex-go
# To create the Docker image
sudo make docker_support_scheduler
# To create a containter from the image
sudo docker create --name "[DOCKER_CONTAINER_NAME]" --network "[DOCKER_NETWORK]" [DOCKER_IMAGE_NAME]
# To run the container
sudo docker start [DOCKER_CONTAINER_NAME]

Note - creating and running the container above requires Docker network setup, may require dependent containers to be setup on that network, and appropriate port access configuration (among other start up parameters). For this reason, EdgeX recommends use of Docker Compose for pulling, building, and running containers. See The Getting Started Guides for more detail.

Community

License

Apache-2.0

Documentation

Overview

******************************************************************************

  • Copyright 2017 Dell Inc. *
  • Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
  • in compliance with the License. You may obtain a copy of the License at *
  • http://www.apache.org/licenses/LICENSE-2.0 *
  • Unless required by applicable law or agreed to in writing, software distributed under the License
  • is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
  • or implied. See the License for the specific language governing permissions and limitations under
  • the License. ******************************************************************************

******************************************************************************

  • Copyright 2018 Dell Inc. *
  • Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
  • in compliance with the License. You may obtain a copy of the License at *
  • http://www.apache.org/licenses/LICENSE-2.0 *
  • Unless required by applicable law or agreed to in writing, software distributed under the License
  • is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
  • or implied. See the License for the specific language governing permissions and limitations under
  • the License. ******************************************************************************

Index

Constants

View Source
const (

	/* -------------- Constants for Scheduler -------------------- */
	ID             = "id"
	NAME           = "name"
	TARGETNAME     = "targetname"
	INTERVALACTION = "intervalaction"
	INTERVAL       = "interval"
	LABEL          = "label"
	YAML           = "yaml"
	COMMAND        = "command"
	KEY            = "key"
	VALUE          = "value"
	UNLOCKED       = "UNLOCKED"
	ENABLED        = "ENABLED"
	TIMELAYOUT     = "20060102T150405"
	SCRUB          = "scrub"
	TARGET         = "target"

	/* ---------------- URL PARAM NAMES -----------------------*/
	ContentTypeKey       = "Content-Type"
	ContentTypeJsonValue = "application/json; charset=utf-8"
	ContentLengthKey     = "Content-Length"
)

Variables

This section is empty.

Functions

func LoadScheduler

func LoadScheduler(
	lc logger.LoggingClient,
	dbClient interfaces.DBClient,
	scClient interfaces.SchedulerQueueClient,
	configuration *config.ConfigurationStruct) error

Utility function for adding configured locally intervals and scheduled events

func Main

func Main(ctx context.Context, cancel context.CancelFunc, router *mux.Router, readyStream chan<- bool)

func StartTicker

func StartTicker(ticker *time.Ticker, lc logger.LoggingClient, configuration *config.ConfigurationStruct)

func StopTicker

func StopTicker(ticker *time.Ticker)

Types

type Bootstrap

type Bootstrap struct {
	// contains filtered or unexported fields
}

Bootstrap contains references to dependencies required by the BootstrapHandler.

func NewBootstrap

func NewBootstrap(router *mux.Router) *Bootstrap

NewBootstrap is a factory method that returns an initialized Bootstrap receiver struct.

func (*Bootstrap) BootstrapHandler

func (b *Bootstrap) BootstrapHandler(ctx context.Context, wg *sync.WaitGroup, _ startup.Timer, dic *di.Container) bool

BootstrapHandler fulfills the BootstrapHandler contract and performs initialization needed by the scheduler service.

type IntervalContext

type IntervalContext struct {
	Interval           models.Interval
	IntervalActionsMap map[string]models.IntervalAction
	StartTime          time.Time
	EndTime            time.Time
	NextTime           time.Time
	Frequency          time.Duration
	CurrentIterations  int64
	MaxIterations      int64
	MarkedDeleted      bool
}

func (*IntervalContext) GetInfo

func (sc *IntervalContext) GetInfo() string

func (*IntervalContext) IsComplete

func (sc *IntervalContext) IsComplete() bool

func (*IntervalContext) Reset

func (sc *IntervalContext) Reset(interval models.Interval, lc logger.LoggingClient)

func (*IntervalContext) UpdateIterations

func (sc *IntervalContext) UpdateIterations()

func (*IntervalContext) UpdateNextTime

func (sc *IntervalContext) UpdateNextTime()

type QueueClient

type QueueClient struct {
	// contains filtered or unexported fields
}

func NewSchedulerQueueClient

func NewSchedulerQueueClient(lc logger.LoggingClient) *QueueClient

NewClient

func (*QueueClient) AddIntervalActionToQueue

func (qc *QueueClient) AddIntervalActionToQueue(intervalAction contract.IntervalAction) error

func (*QueueClient) AddIntervalToQueue

func (qc *QueueClient) AddIntervalToQueue(interval contract.Interval) error

func (*QueueClient) Connect

func (qc *QueueClient) Connect() (string, error)

func (*QueueClient) QueryIntervalActionByID

func (qc *QueueClient) QueryIntervalActionByID(intervalActionId string) (contract.IntervalAction, error)

func (*QueueClient) QueryIntervalActionByName

func (qc *QueueClient) QueryIntervalActionByName(intervalActionName string) (contract.IntervalAction, error)

func (*QueueClient) QueryIntervalByID

func (qc *QueueClient) QueryIntervalByID(intervalId string) (contract.Interval, error)

func (*QueueClient) QueryIntervalByName

func (qc *QueueClient) QueryIntervalByName(intervalName string) (contract.Interval, error)

func (*QueueClient) RemoveIntervalActionQueue

func (qc *QueueClient) RemoveIntervalActionQueue(intervalActionId string) error

func (*QueueClient) RemoveIntervalInQueue

func (qc *QueueClient) RemoveIntervalInQueue(intervalId string) error

func (*QueueClient) UpdateIntervalActionQueue

func (qc *QueueClient) UpdateIntervalActionQueue(intervalAction contract.IntervalAction) error

func (*QueueClient) UpdateIntervalInQueue

func (qc *QueueClient) UpdateIntervalInQueue(interval contract.Interval) error

Directories

Path Synopsis
****************************************************************************** * Copyright 2018 Dell Inc.
****************************************************************************** * Copyright 2018 Dell Inc.
****************************************************************************** * Copyright 2018 Dell Inc.
****************************************************************************** * Copyright 2018 Dell Inc.
operators
interval
****************************************************************************** * Copyright 2019 VMware Inc.
****************************************************************************** * Copyright 2019 VMware Inc.
intervalaction
****************************************************************************** * Copyright 2019 VMware Inc.
****************************************************************************** * Copyright 2019 VMware Inc.

Jump to

Keyboard shortcuts

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