A Logical Framework for Workflow Scheduling under Resource ... · Workflow Scheduling under...

Preview:

Citation preview

A Logical Framework for Workflow Scheduling

under Resource Allocation Constraints

Pinar Senkul(Middle East Technical University, Ankara, Turkey)

Michael Kifer(Stony Brook University, USA)

Ismail H. Toroslu(Middle East Technical University, Ankara, Turkey)

Problem

Workflow Scheduling:

Find execution sequence of tasks in a workflowworkflow so that all constraintsconstraints are satisfied

DefinitionsWorkflow:

A coordinated set of activities that act together to achieve a well-defined goal

Constraints: Temporal/causality

Do t1 only after t2 and t3 have been executedDo t1 if t2 has been or will be executed

Resource allocationExecute workflow keeping the cost below thresholdDon’t use same machine for concurrent subtasks in workflow

Problem (contd.)

Most works deal with temporal/causality constraints

We deal with resource allocation constraints

Example: House Construction Workflow

The budget should not exceed the given amountThe construction should not last longer than the given durationDifferent companies must be chosen for parallel tasks

Approaches to Workflow Scheduling

Operations ResearchAIPetri NetsLogic (temporal, concurrent transaction logic)

Our Approach

CCTR – Concurrent Constraint Transaction LogicIntegrates Concurrent Transaction Logic (CTR) with

Constraint Logic Programming (CLP)

Gives precise semantics to workflows

CanModel

Reason about

Schedule

workflows

Overview of Concurrent Transaction Logic

Extension of first order logic for programming, executing and reasoning with state changing concurrent processes.

Syntax wall ⊗ (( carpentry ⊗ roof ) | installation )

execute wall then in parallel do:carpentry followed by roofinginstallation work

Semantics – paths⟨D0D1D2D3D4⟩

wallwall carpentrycarpentry installinstall roofroof

D0 D1 D2 D3 D4

any interleaving of carpentry⊗roof and installation is a valid execution

Path: sequence of DB states that result from execution of activities

Concurrent Constraint Transaction Logic (CCTR)

syntax: same as in CTR

semantics: partial schedule is more structured thana path, parallel and serial parts of the execution are explicitly shown.

e.g. (⟨D0D1⟩)•p(⟨D1D2•pD2D3⟩ ||p⟨D1D4⟩)

Resources

resource: an object with the attributes cost, token

resource assignment: a partial mapping

partial schedules → set of resources

Constraint System

A partial schedule satisfiessatisfies a resource allocationconstraint c if

c(partial schedule, resource assignment)is true.

A constraint systemconstraint system is a set of constraintdefinitions. It consists of

cost subsystemcost subsystem: contains definitions of cost constraints

control subsystemcontrol subsystem: contains definitions of control constraints

Cost Subsystem - House Construction Workflow

Template: generic procedure for computing costs over schedules

cost_constraint(ω,asg) = value_constraint(cost(ω,asg))cost(ω1•pω2 ,asg) = op⊗(cost(ω1,asg),cost(ω2,asg))cost(ω1||pω2 ,asg) = op|(cost(ω1,asg),cost(ω2,asg))

Problem-specific part for the constraint: "construction should not exceed the given duration”

cost(ω,asg) = cost_of(asg(ω)) value_constraint(V) = V < cop|(V1,V2)= max(V1,V2)op⊗(V1,V2)= V1+V2

Cost of path ω

Schema for computing costs over composite schedules

Control Subsystem - House Construction WorkflowTemplate: generic procedure for computing control constraints

ctrl_constraint(ω1•pω2,asg) = set_constraint⊗(asg(ω1),asg(ω2)), ctrl_constraint(ω1,asg), ctrl_constraint(ω2,asg)

ctrl_constraint(ω1 || pω2,asg) = set_constraint|(asg(ω1),asg(ω2)), ctrl_constraint(ω1,asg), ctrl_constraint(ω2,asg)

ctrl_constraint(ω,asg) = leaf_constraint(asg(ω))

Problem specific part for the constraint: "Different subcontractors must be chosen for parallel tasks”

set_constraint| (R1,R2) = (token_of(R1) ∩ token_of(R2) =∅ )

Satisfy constraints on sequentialsequentialcombo of part.sched

Satisfy constraints on parallelparallel combo of p.sched

Satisfy constraints on each each p.schedp.sched

separatelyseparately

Satisfy constraints on each each p.schedp.sched

separatelyseparately

Logical Entailment in Constraint SystemM, ζ, ω, asg ¦ ϕ

iff

M, ω ¦ ϕ,Ð ¦ cost_constraint( ω, asg) andÐ ¦ ctrl_constraint( ω, asg)

Constraint system Partial

schedule

m-path structure

Resource assignment

CCTR formula

Constraint universe

Using CCTR as a Workflow Scheduler

Take a CCTR workflow which includes constraintsConstruct an equivalent CTR workflow so that:

There is a 1-1 correspondence between the partial schedules of the CCTR workflow and the resulting CTR workflow

These partial schedules & resource assignments for them are computed by the proof theory of CTR

Can now schedule conjunction-free workflows using CTR interpreterCan take advantage of prior work on scheduling workflows under causality/temporal constraints

Transformation Rules

B(G1 ∨ G2) = B(G1) ∨ B(G2)

B(G) = R(G,T)⊗ cost_constraint(T)⊗ ctrl_constraint(T)

R(A,T) = A⊗ (T=resource_asg(A,Agents))

R(G1 | G2, T) = (T='|'(T1,T2))⊗ (R(G1,T1) | R(G1,T2))

R(G1⊗G2, T) = (T='⊗'(T1,T2))⊗ (R(G1,T1) | R(G1,T2))

R(G1∨ G2, T) = R(G1,T) ∨ R(G2,T)

basically structural induction with insertion of constraints inappropriate places

Transformation for Part of House Construction Example

T='|'(T1,T2)⊗((T1= '⊗' (T3,T4)⊗

(((cc ⊗T3=rsrc(c,W)) ⊗(rr ⊗ T4=rsrc(r,X))))

|(T2='|'(T5,T6)⊗

(((ii ⊗ T5=rsrc(i,Y)) |(ee ⊗ T6 = rsrc(e,Z)))))

⊗ cost_constraint(T) ⊗ ctrl_constraint(T)

((carpentry ⊗ roof) | (installation | ceiling)) ∧cost_constraint ∧ ctrl_constraint

Constraint Template – Cost Constraints

Template:cost_constraint(T) :- cost(T,V), value_constraint(V)

cost((T1,T2),V) :- cost(T1,V1), cost(T2,V2), op|(V1,V2,V)

cost(⊗(T1,T2),V) :- cost(T1,V1), cost(T2,V2), op⊗(V1,V2,V)

cost(resource_asg(T,Agents),V):- cost_of(resource_asg(T,Agents),V)

User-defined terms and predicates:

resource_asg(T, A) := rsrc(T,A)cost_of(rsrc(T,A),V) :- duration(T,A,V)value_constraint(V) :- V <cop|(V1,V2,V) :- V = max(V1,V2 )op⊗(V1,V2,V) :- V = V1+V2

-Logic rules that mimic the definition of the cost part of a constraint system

Ensures that duration is within constraints

Constraint Template-Control Constraints

Template:ctrl_constraint(|(T1,T2)) :- set_constraint|(T1,T2),

ctrl_constraint(T1), ctrl_constraint(T2)

ctrl_constraint(⊗(T1,T2)) :- set_constraint⊗(T1,T2), ctrl_constraint(T1), ctrl_constraint(T2)

ctrl_constraint(T) :- leaf(T), leaf_constraint(T)

User-defined predicates:

set_constraint|(T1,T2):- disjoint(T1,T2)

set_constraint⊗(T1,T2) :- true

leaf_constraint(T) :- true

-Same for the control part of a constraint system

Ensures that resources are not shared on

parallel paths

Correctness of the Transformation

Theorem:

Let ζ be a constraint system and Ð be aconstraint domain, which can be represented using the template rules. Then, thetransformation B is a correct prescheduler(I.e., B yields equivalent workflows that satisfy

constraints)

The Big Picture

G Workflow

G’=B(G) Const.

set

Const. def.

Transfornation Rules

CTR Interpreter Constraint

Solver Resource assignment

Rsrc asg term schedule

Conclusion

Presented a logical framework for modelling and scheduling workflows under resource allocation constraints (implemented using a CTR interpreter and XSB)

This framework can be extended with special-purpose constraint solvers optimised for our framework

Scheduling under resource allocation constraints for dynamically changing workflows and for multiple concurrent instances of the same workflow are topics for future work

Recommended