workflow_execution

package
v0.0.0-...-e735f78 Latest Latest
Warning

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

Go to latest
Published: Jul 15, 2025 License: AGPL-3.0 Imports: 21 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Schedule

type Schedule struct {
	Start time.Time
	End   *time.Time
}

type WorkflowExecution

type WorkflowExecution struct {
	utils.AbstractObject                                // AbstractObject contains the basic fields of an object (id, name)
	PeerBuyByGraph       map[string]map[string][]string `json:"peer_buy_by_graph,omitempty" bson:"peer_buy_by_graph,omitempty"`   // BookByResource is a map of the resource id and the list of the booking id
	PeerBookByGraph      map[string]map[string][]string `json:"peer_book_by_graph,omitempty" bson:"peer_book_by_graph,omitempty"` // BookByResource is a map of the resource id and the list of the booking id
	ExecutionsID         string                         `json:"executions_id,omitempty" bson:"executions_id,omitempty"`
	ExecDate             time.Time                      `json:"execution_date,omitempty" bson:"execution_date,omitempty" validate:"required"` // ExecDate is the execution date of the workflow, is required
	EndDate              *time.Time                     `json:"end_date,omitempty" bson:"end_date,omitempty"`                                 // EndDate is the end date of the workflow
	State                enum.BookingStatus             `json:"state" bson:"state" default:"0"`                                               // TEMPORARY TODO DEFAULT 1 -> 0 State is the state of the workflow
	WorkflowID           string                         `json:"workflow_id" bson:"workflow_id,omitempty"`                                     // WorkflowID is the ID of the workflow
}

* WorkflowExecution is a struct that represents a list of workflow executions * Warning: No user can write (del, post, put) a workflow execution, it is only used by the system * workflows generate their own executions

func (*WorkflowExecution) ArgoStatusToState

func (wfa *WorkflowExecution) ArgoStatusToState(status string) *WorkflowExecution

tool to transform the argo status to a state

func (*WorkflowExecution) Book

func (d *WorkflowExecution) Book(executionsID string, wfID string, priceds map[tools.DataType]map[string]pricing.PricedItemITF) []*booking.Booking

func (*WorkflowExecution) Buy

booking is an activity reserved for not a long time investment. ... purchase is dependant of a one time buying. use of a datacenter or storage can't be buy for permanent access.

func (*WorkflowExecution) CanDelete

func (r *WorkflowExecution) CanDelete() bool

func (*WorkflowExecution) CanUpdate

func (r *WorkflowExecution) CanUpdate(set utils.DBObject) (bool, utils.DBObject)

func (*WorkflowExecution) Equals

func (wfa *WorkflowExecution) Equals(we *WorkflowExecution) bool

func (*WorkflowExecution) GenerateID

func (r *WorkflowExecution) GenerateID()

func (*WorkflowExecution) GetAccessor

func (d *WorkflowExecution) GetAccessor(request *tools.APIRequest) utils.Accessor

func (*WorkflowExecution) GetName

func (d *WorkflowExecution) GetName() string

func (*WorkflowExecution) PurgeDraft

func (ws *WorkflowExecution) PurgeDraft(request *tools.APIRequest) error

func (*WorkflowExecution) StoreDraftDefault

func (r *WorkflowExecution) StoreDraftDefault()

func (*WorkflowExecution) VerifyAuth

func (d *WorkflowExecution) VerifyAuth(request *tools.APIRequest) bool

type WorkflowExecutionMongoAccessor

type WorkflowExecutionMongoAccessor struct {
	utils.AbstractAccessor
	// contains filtered or unexported fields
}

func NewAccessor

func NewAccessor(request *tools.APIRequest) *WorkflowExecutionMongoAccessor

func (*WorkflowExecutionMongoAccessor) CopyOne

func (*WorkflowExecutionMongoAccessor) DeleteOne

func (*WorkflowExecutionMongoAccessor) GetExecFilters

func (a *WorkflowExecutionMongoAccessor) GetExecFilters(search string) *dbs.Filters

func (*WorkflowExecutionMongoAccessor) LoadAll

func (*WorkflowExecutionMongoAccessor) LoadOne

func (*WorkflowExecutionMongoAccessor) Search

func (a *WorkflowExecutionMongoAccessor) Search(filters *dbs.Filters, search string, isDraft bool) ([]utils.ShallowDBObject, int, error)

func (*WorkflowExecutionMongoAccessor) StoreOne

func (*WorkflowExecutionMongoAccessor) UpdateOne

type WorkflowSchedule

type WorkflowSchedule struct {
	UUID              string               `json:"id" validate:"required"`                // ExecutionsID is the list of the executions id of the workflow
	Workflow          *workflow.Workflow   `json:"workflow,omitempty"`                    // Workflow is the workflow dependancy of the schedule
	WorkflowExecution []*WorkflowExecution `json:"workflow_executions,omitempty"`         // WorkflowExecution is the list of executions of the workflow
	Message           string               `json:"message,omitempty"`                     // Message is the message of the schedule
	Warning           string               `json:"warning,omitempty"`                     // Warning is the warning message of the schedule
	Start             time.Time            `json:"start" validate:"required,ltfield=End"` // Start is the start time of the schedule, is required and must be less than the End time
	End               *time.Time           `json:"end,omitempty"`                         // End is the end time of the schedule, is required and must be greater than the Start time
	DurationS         float64              `json:"duration_s" default:"-1"`               // End is the end time of the schedule
	Cron              string               `json:"cron,omitempty"`                        // here the cron format : ss mm hh dd MM dw task

	SelectedBillingStrategy pricing.BillingStrategy `json:"selected_billing_strategy"`
}

* WorkflowSchedule is a struct that contains the scheduling information of a workflow * It contains the mode of the schedule (Task or Service), the name of the schedule, the start and end time of the schedule and the cron expression

it's a flying object only use in a session time. It's not stored in the database

func NewScheduler

func NewScheduler(start string, end string, durationInS float64, cron string) *WorkflowSchedule

func (*WorkflowSchedule) CallDatacenter

func (ws *WorkflowSchedule) CallDatacenter(purchase utils.DBObject, destPeerID string, dt tools.DataType, request *tools.APIRequest, errCh chan error, m *sync.Mutex)

func (*WorkflowSchedule) GenerateOrder

func (ws *WorkflowSchedule) GenerateOrder(purchases []*purchase_resource.PurchaseResource, bookings []*booking.Booking, request *tools.APIRequest) error

func (*WorkflowSchedule) GetBuyAndBook

func (*WorkflowSchedule) GetDates

func (ws *WorkflowSchedule) GetDates() ([]Schedule, error)

func (*WorkflowSchedule) GetExecutions

func (ws *WorkflowSchedule) GetExecutions(workflow *workflow.Workflow) ([]*WorkflowExecution, error)

* getExecutions is a function that returns the executions of a workflow * it returns an array of workflow_execution.WorkflowExecution

func (*WorkflowSchedule) Schedules

Jump to

Keyboard shortcuts

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