mirror of
https://github.com/sartography/spiff-arena.git
synced 2025-01-13 02:54:27 +00:00
run_pyl
This commit is contained in:
parent
c8ca5c28d8
commit
f754e5eedc
@ -384,9 +384,6 @@ def _render_instructions_for_end_user(task_model: TaskModel, extensions: Optiona
|
|||||||
return ""
|
return ""
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
def _interstitial_stream(process_instance: ProcessInstanceModel) -> Generator[str, Optional[str], None]:
|
def _interstitial_stream(process_instance: ProcessInstanceModel) -> Generator[str, Optional[str], None]:
|
||||||
processor = ProcessInstanceProcessor(process_instance)
|
processor = ProcessInstanceProcessor(process_instance)
|
||||||
reported_ids = [] # A list of all the ids reported by this endpoint so far.
|
reported_ids = [] # A list of all the ids reported by this endpoint so far.
|
||||||
@ -396,12 +393,11 @@ def _interstitial_stream(process_instance: ProcessInstanceModel) -> Generator[st
|
|||||||
TaskState.WAITING | TaskState.STARTED | TaskState.READY | TaskState.ERROR
|
TaskState.WAITING | TaskState.STARTED | TaskState.READY | TaskState.ERROR
|
||||||
)
|
)
|
||||||
|
|
||||||
def render_instructions(spiff_task: SpiffTask):
|
def render_instructions(spiff_task: SpiffTask) -> str:
|
||||||
task_model = TaskModel.query.filter_by(guid=str(spiff_task.id)).first()
|
task_model = TaskModel.query.filter_by(guid=str(spiff_task.id)).first()
|
||||||
extensions = TaskService.get_extensions_from_task_model(task_model)
|
extensions = TaskService.get_extensions_from_task_model(task_model)
|
||||||
return _render_instructions_for_end_user(task_model, extensions)
|
return _render_instructions_for_end_user(task_model, extensions)
|
||||||
|
|
||||||
|
|
||||||
tasks = get_reportable_tasks()
|
tasks = get_reportable_tasks()
|
||||||
while True:
|
while True:
|
||||||
for spiff_task in tasks:
|
for spiff_task in tasks:
|
||||||
@ -417,7 +413,7 @@ def _interstitial_stream(process_instance: ProcessInstanceModel) -> Generator[st
|
|||||||
raise e
|
raise e
|
||||||
if instructions and spiff_task.id not in reported_ids:
|
if instructions and spiff_task.id not in reported_ids:
|
||||||
task = ProcessInstanceService.spiff_task_to_api_task(processor, spiff_task)
|
task = ProcessInstanceService.spiff_task_to_api_task(processor, spiff_task)
|
||||||
task.properties = {'instructionsForEndUser': instructions}
|
task.properties = {"instructionsForEndUser": instructions}
|
||||||
yield f"data: {current_app.json.dumps(task)} \n\n"
|
yield f"data: {current_app.json.dumps(task)} \n\n"
|
||||||
reported_ids.append(spiff_task.id)
|
reported_ids.append(spiff_task.id)
|
||||||
if spiff_task.state == TaskState.READY:
|
if spiff_task.state == TaskState.READY:
|
||||||
@ -457,7 +453,7 @@ def _interstitial_stream(process_instance: ProcessInstanceModel) -> Generator[st
|
|||||||
)
|
)
|
||||||
yield f"data: {current_app.json.dumps(api_error)} \n\n"
|
yield f"data: {current_app.json.dumps(api_error)} \n\n"
|
||||||
raise e
|
raise e
|
||||||
task.properties = []
|
task.properties = {"instructionsForEndUser": instructions}
|
||||||
yield f"data: {current_app.json.dumps(task)} \n\n"
|
yield f"data: {current_app.json.dumps(task)} \n\n"
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user