Skip to content

Commit

Permalink
Expose MalleableChoose to Python.
Browse files Browse the repository at this point in the history
  • Loading branch information
sukritkalra committed Oct 26, 2023
1 parent 8d17de2 commit 014e98b
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions schedulers/tetrisched/python/Expressions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ void defineSTRLExpressions(py::module_& tetrisched_m) {
.value("EXPR_SCALE", tetrisched::ExpressionType::EXPR_SCALE)
.value("EXPR_LESSTHAN", tetrisched::ExpressionType::EXPR_LESSTHAN)
.value("EXPR_ALLOCATION", tetrisched::ExpressionType::EXPR_ALLOCATION)
.value("EXPR_MALLEABLE_CHOOSE",
tetrisched::ExpressionType::EXPR_MALLEABLE_CHOOSE)
.export_values();

// Define the Placement object.
Expand Down Expand Up @@ -112,6 +114,22 @@ void defineSTRLExpressions(py::module_& tetrisched_m) {
"`numRequiredMachines` from the given partition at the given "
"startTime, running for the given duration.");

// Define the MalleableChooseExpression.
py::class_<tetrisched::MalleableChooseExpression, tetrisched::Expression,
std::shared_ptr<tetrisched::MalleableChooseExpression>>(
tetrisched_m, "MalleableChooseExpression")
.def(py::init([](std::string taskName, tetrisched::Partitions partitions,
uint32_t resourceTimeSlots, tetrisched::Time startTime,
tetrisched::Time endTime, tetrisched::Time granularity) {
return std::make_shared<tetrisched::MalleableChooseExpression>(
taskName, partitions, resourceTimeSlots, startTime, endTime,
granularity);
}),
"Initializes a MalleableChooseExpression for the given task to be "
"placed on the given partitions at the given startTime, "
"ending at the given end time and taking up the given "
"resourceTimeSlots");

// Define the AllocationExpression.
py::class_<tetrisched::AllocationExpression, tetrisched::Expression,
std::shared_ptr<tetrisched::AllocationExpression>>(
Expand Down

0 comments on commit 014e98b

Please sign in to comment.