scheduler

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Jul 25, 2019 License: Apache-2.0 Imports: 33 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 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. ******************************************************************************

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

  • 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.
  • Copyright (c) 2019 Intel Corporation *
  • 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. ******************************************************************************

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

  • 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. ******************************************************************************

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

  • 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. ******************************************************************************

Copyright (c) 2018 Dell Inc.

SPDX-License-Identifier: Apache-2.0

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

  • 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"
	SCHEDULER_TIMELAYOUT = "20060102T150405" /** Scheduler **/
	TIMELAYOUT           = "20060102T150405" /** Scheduler **/

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

Variables

View Source
var LoggingClient logger.LoggingClient

Functions

func Destruct added in v1.0.0

func Destruct()

func Init added in v1.0.0

func Init(useRegistry bool) bool

func LoadRestRoutes added in v1.0.0

func LoadRestRoutes() *mux.Router

func LoadScheduler

func LoadScheduler() error

Utility function for adding configured locally intervals and scheduled events

func Retry added in v1.0.0

func Retry(useRegistry bool, useProfile string, timeout int, wait *sync.WaitGroup, ch chan error)

func StartTicker

func StartTicker()

func StopTicker

func StopTicker()

Types

type ConfigurationStruct added in v1.0.0

type ConfigurationStruct struct {
	Writable        WritableInfo
	Clients         map[string]config.ClientInfo
	Databases       map[string]config.DatabaseInfo
	Logging         config.LoggingInfo
	Registry        config.RegistryInfo
	Service         config.ServiceInfo
	Intervals       map[string]config.IntervalInfo
	IntervalActions map[string]config.IntervalActionInfo
}

Configuration V2 for the Support Scheduler Service

var Configuration *ConfigurationStruct

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)

func (*IntervalContext) UpdateIterations

func (sc *IntervalContext) UpdateIterations()

func (*IntervalContext) UpdateNextTime

func (sc *IntervalContext) UpdateNextTime()

type QueueClient

type QueueClient struct {
}

func NewSchedulerQueueClient

func NewSchedulerQueueClient() *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

type WritableInfo added in v1.0.0

type WritableInfo struct {
	ScheduleIntervalTime int
	LogLevel             string
}

Directories

Path Synopsis
****************************************************************************** * Copyright 2018 Dell Inc.
****************************************************************************** * Copyright 2018 Dell Inc.
****************************************************************************** * Copyright 2018 Dell Inc.
****************************************************************************** * Copyright 2018 Dell Inc.

Jump to

Keyboard shortcuts

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