Documentation
¶
Index ¶
- type BookingState
- type ExecutionGraph
- type ExecutionGraphItem
- type ExecutionStepState
- type WorkflowExecution
- func (wfa *WorkflowExecution) ArgoStatusToState(status string) *WorkflowExecution
- func (d *WorkflowExecution) Book(executionsID string, wfID string, ...) []*booking.Booking
- func (d *WorkflowExecution) Buy(bs pricing.BillingStrategy, executionsID string, wfID string, ...) []*purchase_resource.PurchaseResource
- func (r *WorkflowExecution) CanDelete() bool
- func (r *WorkflowExecution) CanUpdate(set utils.DBObject) (bool, utils.DBObject)
- func (wfa *WorkflowExecution) Equals(we *WorkflowExecution) bool
- func (ri *WorkflowExecution) Extend(typ ...string) map[string][]tools.DataType
- func (r *WorkflowExecution) GenerateID()
- func (d *WorkflowExecution) GetAccessor(request *tools.APIRequest) utils.Accessor
- func (d *WorkflowExecution) GetName() string
- func (ws *WorkflowExecution) PurgeDraft(request *tools.APIRequest) error
- func (r *WorkflowExecution) StoreDraftDefault()
- func (d *WorkflowExecution) VerifyAuth(callName string, request *tools.APIRequest) bool
- type WorkflowExecutionMongoAccessor
- func (a *WorkflowExecutionMongoAccessor) GetExec(isDraft bool) func(utils.DBObject) utils.ShallowDBObject
- func (a *WorkflowExecutionMongoAccessor) GetObjectFilters(search string) *dbs.Filters
- func (a *WorkflowExecutionMongoAccessor) LoadOne(id string) (utils.DBObject, int, error)
- func (wfa *WorkflowExecutionMongoAccessor) UpdateOne(set map[string]interface{}, id string) (utils.DBObject, int, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BookingState ¶
type BookingState struct {
IsBooked bool `json:"is_booked" bson:"is_booked"`
IsDone bool `json:"is_done" bson:"is_done"`
}
BookingState tracks the reservation and completion status of a single booking within a workflow execution.
- IsBooked: true while the resource is actively reserved (set on WORKFLOW_STARTED_EVENT, cleared on WORKFLOW_STEP_DONE_EVENT / WORKFLOW_DONE_EVENT).
- IsDone: true once the booking has been confirmed by the remote peer (CONSIDERS_EVENT) or completed (WORKFLOW_STEP_DONE_EVENT / WORKFLOW_DONE_EVENT).
type ExecutionGraph ¶
type ExecutionGraph map[string]ExecutionGraphItem
ExecutionGraph is a flat, scheduler-friendly summary of a workflow execution graph. The map key is the workflow graph item ID.
func BuildExecutionGraph ¶
func BuildExecutionGraph(g *workflowgraph.Graph) ExecutionGraph
BuildExecutionGraph derives an initial ExecutionGraph (all steps in StepWaiting) from a workflow graph. It infers:
- Deps : predecessor item IDs based on link direction
- WhenRunning : sibling item IDs connected to a step by a link (i.e. resources that are co-active when the step runs)
func (ExecutionGraph) Depssatisfied ¶
func (eg ExecutionGraph) Depssatisfied(itemID string) bool
Depssatisfied returns true when all deps of the given item have reached StepSuccess.
func (ExecutionGraph) MarkDone ¶
func (eg ExecutionGraph) MarkDone(itemID string, success bool, at time.Time)
MarkDone transitions the step to StepSuccess or StepFailure and records the end time.
func (ExecutionGraph) MarkRunning ¶
func (eg ExecutionGraph) MarkRunning(itemID string, at time.Time)
MarkRunning transitions the step to StepRunning and records the start time. It is a no-op if the step is already beyond StepRunning.
func (ExecutionGraph) ReadyToRun ¶
func (eg ExecutionGraph) ReadyToRun() []string
ReadyToRun returns the IDs of all steps that are still waiting and whose deps are fully satisfied. Useful for the scheduler to decide what to start next.
type ExecutionGraphItem ¶
type ExecutionGraphItem struct {
Name string `json:"name" bson:"name"`
StartDate *time.Time `json:"start_date,omitempty" bson:"start_date,omitempty"`
EndDate *time.Time `json:"end_date,omitempty" bson:"end_date,omitempty"`
State ExecutionStepState `json:"state" bson:"state"`
Deps []string `json:"deps,omitempty" bson:"deps,omitempty"`
WhenRunning []string `json:"when_running,omitempty" bson:"when_running,omitempty"`
}
ExecutionGraphItem is the summarized view of one node in the workflow execution graph.
- Name : human-readable label (resource name or item ID as fallback)
- StartDate : set when the step transitions to StepRunning
- EndDate : set when the step transitions to StepSuccess or StepFailure
- State : current lifecycle state of the step
- Deps : itemIDs that must reach StepSuccess before this step can start
- WhenRunning : itemIDs (resources) that become active while this step is running (e.g. the compute node executing it, the storage it reads/writes)
type ExecutionStepState ¶
type ExecutionStepState string
ExecutionStepState is the runtime state of a single step in the execution graph.
const ( StepWaiting ExecutionStepState = "waiting" StepRunning ExecutionStepState = "running" StepSuccess ExecutionStepState = "success" StepFailure ExecutionStepState = "failure" )
type WorkflowExecution ¶
type WorkflowExecution struct {
utils.AbstractObject // AbstractObject contains the basic fields of an object (id, name)
Priority int `json:"priority" bson:"priority"` // will best effort on default // Will Best Effort on priority
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
BookingsState map[string]BookingState `json:"bookings_state" bson:"bookings_state,omitempty"` // booking_id → reservation+completion status
PurchasesState map[string]bool `json:"purchases_state" bson:"purchases_state,omitempty"` // purchase_id → confirmed
// Graph is a lightweight, real-time summary of the workflow execution graph.
// Keyed by workflow graph item ID; updated by oc-scheduler on each step-done event.
// Consumed by oc-front to render the live execution panel via websocket updates.
Graph ExecutionGraph `json:"graph,omitempty" bson:"graph,omitempty"`
SelectedInstances workflow.ConfigItem `json:"selected_instances"`
SelectedPartnerships workflow.ConfigItem `json:"selected_partnerships"`
SelectedBuyings workflow.ConfigItem `json:"selected_buyings"`
SelectedStrategies workflow.ConfigItem `json:"selected_strategies"`
SelectedPaymentMode workflow.ConfigItem `json:"selected_payment_mode"`
// SelectedBillingStrategy est la fréquence de facturation globale choisie par l'utilisateur
// (BILL_ONCE, BILL_PER_WEEK, BILL_PER_MONTH, BILL_PER_YEAR).
// Propagée depuis WorkflowSchedule.SelectedBillingStrategy par GenerateExecutions().
SelectedBillingStrategy pricing.BillingStrategy `json:"selected_billing_strategy" bson:"selected_billing_strategy"`
// SelectedEmbeddedStorages records which storage capability was activated on
// each compute unit graph node (key = compute graph node ID).
// Populated by oc-scheduler, consumed by oc-monitord's argo builder.
SelectedEmbeddedStorages map[string]*resources.EmbeddedStorageSelection `json:"selected_embedded_storages,omitempty" bson:"selected_embedded_storages,omitempty"`
}
* 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 ¶
func (d *WorkflowExecution) Buy(bs pricing.BillingStrategy, executionsID string, wfID string, priceds map[tools.DataType]map[string]pricing.PricedItemITF) []*purchase_resource.PurchaseResource
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) Equals ¶
func (wfa *WorkflowExecution) Equals(we *WorkflowExecution) bool
func (*WorkflowExecution) Extend ¶
func (ri *WorkflowExecution) Extend(typ ...string) map[string][]tools.DataType
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(callName string, request *tools.APIRequest) bool
type WorkflowExecutionMongoAccessor ¶
type WorkflowExecutionMongoAccessor struct {
utils.AbstractAccessor[*WorkflowExecution]
// contains filtered or unexported fields
}
func NewAccessor ¶
func NewAccessor(request *tools.APIRequest) *WorkflowExecutionMongoAccessor
func (*WorkflowExecutionMongoAccessor) GetExec ¶
func (a *WorkflowExecutionMongoAccessor) GetExec(isDraft bool) func(utils.DBObject) utils.ShallowDBObject
func (*WorkflowExecutionMongoAccessor) GetObjectFilters ¶
func (a *WorkflowExecutionMongoAccessor) GetObjectFilters(search string) *dbs.Filters