Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
41 changes: 7 additions & 34 deletions pdm.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions src/ui/src/components/AdminButtons/LockUnlockButton.vue
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
main_url: string;
module?: string;
wc_state?: any;
module_status?: string;
module_status?: any;
}>();

const lock_url = ref()
Expand All @@ -51,7 +51,7 @@
if (props.module) {
watchEffect(() => {
// Determine if the module is already locked
if (props.module_status == 'LOCKED') {
if (props.module_status["LOCKED"] == true) {
isLocked.value = true
} else {
if (props.wc_state) {
Expand Down
6 changes: 3 additions & 3 deletions src/ui/src/components/AdminButtons/PauseResumeButton.vue
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
const props = defineProps<{
main_url: string;
module?: string;
module_status?: string;
module_status?: any;
wc_state?: any;
}>();

Expand All @@ -54,14 +54,14 @@
if (props.module) {
watchEffect(() => {
// Determine if pressing pause/resume button should be allowed
if (props.module_status == "BUSY" || props.module_status == "PAUSED") {
if (props.module_status["BUSY"] == true || props.module_status["PAUSED"] == true) {
allowButton.value = true
} else {
allowButton.value = false
}

// Determine if the module is already paused
if (props.module_status == 'PAUSED') {
if (props.module_status["PAUSED"] == true) {
isPaused.value = true
} else {
isPaused.value = false
Expand Down
32 changes: 31 additions & 1 deletion src/ui/src/components/ModulesPanel.vue
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
<v-row no-gutter wrap justify-content class="pa-1">
<v-col class="pa-1" cols=12 xl=6 v-for="(value, module_name) in modules" :key="module_name">
<v-card class="pa-1 module_indicator" @click="set_modal(String(module_name), value.about)"
:class="'module_status_' + value.state.status">
:class="'module_status_' + get_status(value.state.status)">
<v-card-text>
<h4>{{ module_name }}</h4>

Expand Down Expand Up @@ -42,4 +42,34 @@ const set_modal = (title: string, value: Object) => {
modal_text.value = value
modal.value = true
}
const get_status = (value: any) => {
if(value["ERROR"] && value["ERROR"] != false) {
return "ERROR"


}
if(value["CANCELLED"] && value["CANCELLED"] != false) {
return "CANCELLED"


}
if(value["LOCKED"] && value["LOCKED"] != false) {
return "LOCKED"


}
if(value["PAUSED"] && value["PAUSED"] != false) {
return "PAUSED"
}

if(value["BUSY"] && value["BUSY"]) {
return "BUSY"
} else {

return "READY"
}


}

</script>
5 changes: 1 addition & 4 deletions src/wei/core/scheduler.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@
from datetime import datetime

from wei.core.events import send_event
from wei.core.location import reserve_source_and_target
from wei.core.module import reserve_module
from wei.core.state_manager import state_manager
from wei.core.step import check_step, run_step
from wei.core.workcell import find_step_module
Expand Down Expand Up @@ -44,8 +42,7 @@ def run_iteration(self) -> None:
module = find_step_module(
state_manager.get_workcell(), step.module
)
reserve_module(module, wf_run.run_id)
reserve_source_and_target(wf_run)

if wf_run.status == WorkflowStatus.QUEUED:
send_event(WorkflowStartEvent.from_wf_run(wf_run=wf_run))
wf_run.status = WorkflowStatus.RUNNING
Expand Down
49 changes: 23 additions & 26 deletions src/wei/core/step.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
from datetime import datetime
from typing import Tuple

from wei.config import Config
from wei.core.events import send_event
from wei.core.location import free_source_and_target, update_source_and_target
from wei.core.loggers import Logger
Expand Down Expand Up @@ -71,36 +70,27 @@ def validate_step(step: Step) -> Tuple[bool, str]:

def check_step(experiment_id: str, run_id: str, step: Step) -> bool:
"""Check if a step is able to be run by the workcell."""
if Config.verify_locations_before_transfer:
if "target" in step.locations:
location = state_manager.get_location(step.locations["target"])
if not (location.state == "Empty"):
print(f"Can't run '{run_id}.{step.name}', target is not empty")
return False
if location.reserved and location.reserved != run_id:
print(f"Can't run '{run_id}.{step.name}', target is reserved")
return False
if "source" in step.locations:
location = state_manager.get_location(step.locations["source"])
if not (location.state == str(experiment_id)):
print(
f"Can't run '{run_id}.{step.name}', source asset doesn't belong to experiment"
)
return False
if location.reserved and location.reserved != run_id:
print(f"Can't run {run_id}.{step.name}, source is reserved")
return False
return check_module_status(step, run_id) and check_dependency_status(step)


def check_module_status(step: Step, run_id: str):
"""Returns true if the module is able to run based on the module status"""
module = state_manager.get_module(step.module)
if ModuleStatus(module.state.status) != ModuleStatus.READY:
if module.state.status[ModuleStatus.READY] and not (
module.state.status[ModuleStatus.LOCKED]
or module.state.status[ModuleStatus.PAUSED]
or module.state.status[ModuleStatus.CANCELLED]
):
return True
else:
print(
f"Can't run '{run_id}.{step.name}', module '{step.module}' is not idle. Module status: {module.state.status}"
)
return False
if module.reserved and module.reserved != run_id:
print(
f"Can't run '{run_id}.{step.name}', module '{step.module}' is reserved by workflow '{module.reserved}'"
)
return False


def check_dependency_status(step: Step):
"""Returns true if the module is able to run based on the step requirements"""
return True


Expand Down Expand Up @@ -131,6 +121,13 @@ def run_step(
error=error,
files=files,
)
if step_response.status == StepStatus.NOT_READY:
wf_run.status = WorkflowStatus.IN_PROGRESS
step.result = step_response
with state_manager.wc_state_lock():
wf_run.steps[wf_run.step_index] = step
state_manager.set_workflow_run(wf_run)
return
except Exception as e:
logger.debug(f"Exception occurred while running step with name: {step.name}")
logger.debug(str(e))
Expand Down
Loading