utask: github.com/ovh/utask Index | Files | Directories

package utask

import "github.com/ovh/utask"

Index

Package Files

utask.go

Constants

const (
    // DBName is the name of µTask DB, as registered on zesty
    DBName = "uservice_task"

    // MaxPageSize is the upper limit for the number of elements returned in a single page
    MaxPageSize = 10000
    // DefaultPageSize is the default number of elements returned in a single page
    DefaultPageSize = 1000
    // MinPageSize is the lower limit for the number of elements returned in a single page
    MinPageSize = 10

    // DefaultRetryMax is the default number of retries allowed for a task's execution
    DefaultRetryMax = 100

    // MaxTextSizeLong is the maximum number of characters accepted in a text-type field
    MaxTextSizeLong = 100000 // ~100 kB
    // MaxTextSize is the maximum number of characters accepted in a simple string field
    MaxTextSize = 1000 // ~1 kB
    // MinTextSize is the minimum number of characters accepted in any string-type field
    MinTextSize = 3

    // This is the key used in Values for a step to refer to itself
    This = "this"

    // UtaskCfgSecretAlias is the key for the config item containing global configuration data
    UtaskCfgSecretAlias = "utask-cfg"
)

Variables

var (
    // Version holds the tag of current µTask release
    Version string
    // Commit is the current git commit hash
    Commit string
    // App name (from configuration)
    App string
    // InstanceID identifies this running instance of µTask, as registered in DB
    InstanceID uint64

    // FInitializersFolder is the path to a folder containing
    // .so plugins for µTask initialization
    FInitializersFolder string
    // FPluginFolder is the path to a folder containing
    // .so plugins to be registered as step action executors
    FPluginFolder string
    // FTemplatesFolder is the path to a folder containing
    // .yaml templates for tasks
    FTemplatesFolder string
    // FFunctionsFolder is the path to a folder containing
    // functions files used by script plugin
    FFunctionsFolder string
    // FScriptsFolder is the path to a folder containing
    // scripts files used by script plugin
    FScriptsFolder string
    // FRegion is the region in which this instance of µTask is running
    FRegion string
    // FPort is the port on which the http server listens
    FPort uint
    // FDebug is a flag to toggle debug log
    FDebug bool
    // FMaintenanceMode is a flag to prevent all write operations on the API,
    // except for admin actions (key rotation)
    FMaintenanceMode bool
)

func AcquireExecutionSlot Uses

func AcquireExecutionSlot()

AcquireExecutionSlot takes a slot from a global semaphore putting a cap on the total amount of concurrent task executions

func AcquireResource Uses

func AcquireResource(name string)

AcquireResource takes a semaphore slot for a named resource limiting the amount of concurrent actions runnable on said resource

func AcquireResources Uses

func AcquireResources(names []string)

AcquireResources is an helper to call AcquireResource with an array

func AppName Uses

func AppName() string

AppName returns the name of the application (from config)

func ReleaseExecutionSlot Uses

func ReleaseExecutionSlot()

ReleaseExecutionSlot frees up a slot on the global execution semaphore

func ReleaseResource Uses

func ReleaseResource(name string)

ReleaseResource frees up a semaphore slot for a named resource

func ReleaseResources Uses

func ReleaseResources(names []string)

ReleaseResources is an helper to call ReleaseResource with an array

type Cfg Uses

type Cfg struct {
    ApplicationName                            string                   `json:"application_name"`
    AdminUsernames                             []string                 `json:"admin_usernames"`
    CompletedTaskExpiration                    string                   `json:"completed_task_expiration"`
    NotifyConfig                               map[string]NotifyBackend `json:"notify_config"`
    NotifyActions                              NotifyActions            `json:"notify_actions"`
    DatabaseConfig                             *DatabaseConfig          `json:"database_config"`
    ConcealedSecrets                           []string                 `json:"concealed_secrets"`
    ResourceLimits                             map[string]uint          `json:"resource_limits"`
    MaxConcurrentExecutions                    *int                     `json:"max_concurrent_executions"`
    MaxConcurrentExecutionsFromCrashed         *int                     `json:"max_concurrent_executions_from_crashed"`
    MaxConcurrentExecutionsFromCrashedComputed int                      `json:"-"`
    DelayBetweenCrashedTasksResolution         string                   `json:"delay_between_crashed_tasks_resolution"`
    InstanceCollectorWaitDuration              time.Duration            `json:"-"`
    DashboardPathPrefix                        string                   `json:"dashboard_path_prefix"`
    DashboardAPIPathPrefix                     string                   `json:"dashboard_api_path_prefix"`
    DashboardSentryDSN                         string                   `json:"dashboard_sentry_dsn"`
    EditorPathPrefix                           string                   `json:"editor_path_prefix"`
    ServerOptions                              ServerOpt                `json:"server_options"`
    // contains filtered or unexported fields
}

Cfg holds global configuration data

func Config Uses

func Config(store *configstore.Store) (*Cfg, error)

Config returns the global configuration data of this instance once lazy-loaded from configstore

type DatabaseConfig Uses

type DatabaseConfig struct {
    MaxOpenConns    *int   `json:"max_open_conns"`
    MaxIdleConns    *int   `json:"max_idle_conns"`
    ConnMaxLifetime *int   `json:"conn_max_lifetime"`
    ConfigName      string `json:"config_name"`
}

DatabaseConfig holds configuration to fine-tune DB connection

type NotifyActions Uses

type NotifyActions struct {
    TaskStateAction NotifyActionsParameters `json:"task_state_action,omitempty"`
}

NotifyActions holds configuration of each actions By default all the actions are enabled /w any config name registered

type NotifyActionsParameters Uses

type NotifyActionsParameters struct {
    Disabled       bool     `json:"disabled"`
    NotifyBackends []string `json:"notify_backends"`
}

NotifyActionsParameters holds configuration needed to define each Notify actions If NotifyBackends is empty, the default is any

type NotifyBackend Uses

type NotifyBackend struct {
    Type   string          `json:"type"`
    Config json.RawMessage `json:"config"`
}

NotifyBackend holds configuration for instantiating a notify client

type NotifyBackendSlack Uses

type NotifyBackendSlack struct {
    WebhookURL string `json:"webhook_url"`
}

NotifyBackendSlack holds configuration for instantiating a Slack notify client

type NotifyBackendTat Uses

type NotifyBackendTat struct {
    Username string `json:"username"`
    Password string `json:"password"`
    URL      string `json:"url"`
    Topic    string `json:"topic"`
}

NotifyBackendTat holds configuration for instantiating a Tat notify client

type ServerOpt Uses

type ServerOpt struct {
    MaxBodyBytes int64 `json:"max_body_bytes"`
}

ServerOpt holds the configuration for the http server

Directories

PathSynopsis
api
api/handler
db
db/dberrors
db/dberrors/pganalyzer
db/pgjuju
db/sqlgenerator
engine
engine/functions
engine/functions/runner
engine/input
engine/step
engine/step/condition
engine/step/executor
engine/values
models
models/resolution
models/runnerinstance
models/task
models/tasktemplate
pkg/auth
pkg/constants
pkg/jsonschema
pkg/notify
pkg/notify/init
pkg/notify/slack
pkg/notify/tat
pkg/now
pkg/plugins
pkg/plugins/builtin
pkg/plugins/builtin/apiovh
pkg/plugins/builtin/echo
pkg/plugins/builtin/email
pkg/plugins/builtin/http
pkg/plugins/builtin/httputil
pkg/plugins/builtin/notify
pkg/plugins/builtin/ping
pkg/plugins/builtin/script
pkg/plugins/builtin/scriptutil
pkg/plugins/builtin/ssh
pkg/plugins/builtin/subtask
pkg/plugins/builtin/tag
pkg/plugins/taskplugin
pkg/taskutils
pkg/templateimport
pkg/utils

Package utask imports 6 packages (graph) and is imported by 19 packages. Updated 2020-09-30. Refresh now. Tools for package owners.