mirror of
https://github.com/sartography/spiff-arena.git
synced 2025-03-04 02:50:38 +00:00
fixed tests w/ burnettk
This commit is contained in:
parent
b9ee34c72d
commit
8522db35ce
@ -1,10 +1,9 @@
|
||||
#!/usr/bin/env python3
|
||||
import os
|
||||
import sys
|
||||
import subprocess
|
||||
import concurrent.futures
|
||||
import json
|
||||
from datetime import datetime
|
||||
import os
|
||||
import subprocess
|
||||
import sys
|
||||
|
||||
|
||||
def get_access_token(script_dir, username="admin", password="admin", realm_name="spiffworkflow"):
|
||||
@ -80,13 +79,13 @@ def load_test(message_identifier, num_requests=10, max_workers=5, username="admi
|
||||
|
||||
# Log failures to a file if any exist
|
||||
if failure_log:
|
||||
filename = f"failure_log.json"
|
||||
filename = "failure_log.json"
|
||||
with open(filename, "w") as f:
|
||||
json.dump(failure_log, f, indent=2)
|
||||
print(f"\nFailure details logged to {filename}")
|
||||
|
||||
# Print summary
|
||||
print(f"\nLoad Test Summary:")
|
||||
print("\nLoad Test Summary:")
|
||||
print(f"Total Requests: {num_requests}")
|
||||
print(f"Successful Requests: {successful_requests}")
|
||||
print(f"Failed Requests: {failed_requests}")
|
@ -227,7 +227,8 @@ line-length = 130
|
||||
target-version = "py310"
|
||||
|
||||
exclude = [
|
||||
"migrations"
|
||||
"migrations",
|
||||
"bin/load_test_message_start_event.py"
|
||||
]
|
||||
|
||||
[tool.ruff.lint.per-file-ignores]
|
||||
|
@ -1,4 +1,3 @@
|
||||
import time
|
||||
from typing import Any
|
||||
|
||||
from flask import current_app
|
||||
@ -65,8 +64,8 @@ class MessageService:
|
||||
for message_instance in available_receive_messages:
|
||||
if message_instance.correlates(message_instance_send, CustomBpmnScriptEngine()):
|
||||
message_instance_receive = message_instance
|
||||
receiving_process_instance = None
|
||||
message_triggerable_process_model = None
|
||||
receiving_process_instance = None
|
||||
if message_instance_receive is None:
|
||||
# Check for a message triggerable process and start that to create a new message_instance_receive
|
||||
message_triggerable_process_model = MessageTriggerableProcessModel.query.filter_by(
|
||||
@ -96,7 +95,11 @@ class MessageService:
|
||||
db.session.add(message_instance_receive)
|
||||
db.session.commit()
|
||||
|
||||
if message_instance_receive is None or not receiving_process_instance.can_receive_message():
|
||||
if (
|
||||
message_instance_receive is None
|
||||
or receiving_process_instance is None
|
||||
or not receiving_process_instance.can_receive_message()
|
||||
):
|
||||
# Assure we can send the message, otherwise keep going.
|
||||
message_instance_send.status = "ready"
|
||||
db.session.add(message_instance_send)
|
||||
@ -107,15 +110,15 @@ class MessageService:
|
||||
processor_receive.save()
|
||||
else:
|
||||
db.session.commit()
|
||||
# return None
|
||||
exception_message = f"Bad Message Instance: Receive {message_instance_receive}."
|
||||
if receiving_process_instance:
|
||||
exception_message += f" PI: {receiving_process_instance.can_receive_message()}"
|
||||
else:
|
||||
exception_message += " PI: None"
|
||||
exception_message += f" TRIGGER: {message_triggerable_process_model}"
|
||||
exception_message += f" SEND: {message_instance_send}"
|
||||
raise Exception(exception_message)
|
||||
return None
|
||||
# exception_message = f"Bad Message Instance: Receive {message_instance_receive}."
|
||||
# if receiving_process_instance:
|
||||
# exception_message += f" PI: {receiving_process_instance.can_receive_message()}"
|
||||
# else:
|
||||
# exception_message += " PI: None"
|
||||
# exception_message += f" TRIGGER: {message_triggerable_process_model}"
|
||||
# exception_message += f" SEND: {message_instance_send}"
|
||||
# raise Exception(exception_message)
|
||||
|
||||
try:
|
||||
with ProcessInstanceQueueService.dequeued(receiving_process_instance, needs_dequeue=False):
|
||||
@ -151,8 +154,8 @@ class MessageService:
|
||||
processor_receive.save()
|
||||
else:
|
||||
db.session.commit()
|
||||
# return None
|
||||
raise
|
||||
return None
|
||||
# raise
|
||||
|
||||
except Exception as exception:
|
||||
db.session.rollback()
|
||||
|
@ -141,7 +141,8 @@ class ProcessInstanceQueueService:
|
||||
)
|
||||
|
||||
# we call dequeued multiple times but we want this code to only happen once.
|
||||
# assume that if we are not reentering_lock then this is the top level call and should be the one to handle the error.
|
||||
# assume that if we are not reentering_lock then this is the top level call and
|
||||
# should be the one to handle the error.
|
||||
if not reentering_lock:
|
||||
ErrorHandlingService.handle_error(process_instance, ex)
|
||||
raise ex
|
||||
|
Loading…
x
Reference in New Issue
Block a user