26 lines
915 B
Python
26 lines
915 B
Python
from datetime import datetime
|
|
from core.operation.operation import buildOperation
|
|
|
|
def buildManager(definition):
|
|
operations = definition.operations
|
|
|
|
current_time = datetime.now().time()
|
|
|
|
for operation in operations:
|
|
if hasattr(operation, "role") and operation.role == "activate":
|
|
if definition.uptime <= current_time <= definition.downtime:
|
|
while True:
|
|
current_time = datetime.now().time()
|
|
outputs = buildOperation(operation)
|
|
|
|
if hasattr(operation, "role") and operation.role == "deactivate":
|
|
if definition.downtime <= current_time <= definition.uptime:
|
|
while True:
|
|
current_time = datetime.now().time()
|
|
outputs = buildOperation(operation)
|
|
|
|
# if hasattr(operation, "role") and role == offline:
|
|
# outputs = buildOperation(operation)
|
|
|
|
|