do not look for called elements if spiff already knows about them w/ burnettk

This commit is contained in:
jasquat 2022-09-12 11:13:03 -04:00
parent db0729bd7f
commit 5b43326fb6
4 changed files with 28 additions and 15 deletions

View File

@ -280,7 +280,7 @@ paths:
schema:
$ref: "#/components/schemas/WorkflowSpec"
/process-models/{process_group_id}/{process_model_id}/file:
/process-models/{process_group_id}/{process_model_id}/files:
parameters:
- name: process_group_id
in: path

View File

@ -471,11 +471,18 @@ class ProcessInstanceProcessor:
etree_element = SpecFileService.get_etree_element_from_file_name(
process_model, process_model.primary_file_name
)
bpmn_process_identifiers = (
SpecFileService.get_executable_bpmn_process_identifiers(
etree_element
bpmn_process_identifiers = []
try:
bpmn_process_identifiers = (
SpecFileService.get_executable_bpmn_process_identifiers(
etree_element
)
)
)
except ValidationException:
# ignore validation errors here
pass
if bpmn_process_identifier in bpmn_process_identifiers:
SpecFileService.store_bpmn_process_identifiers(
process_model,
@ -497,9 +504,15 @@ class ProcessInstanceProcessor:
processed_identifiers = set()
processor_dependencies = parser.get_process_dependencies()
processor_dependencies_new = processor_dependencies - processed_identifiers
bpmn_process_identifiers_in_parser = parser.find_all_specs().keys()
new_bpmn_files = set()
for bpmn_process_identifier in processor_dependencies_new:
# ignore identifiers that spiff already knows about
if bpmn_process_identifier in bpmn_process_identifiers_in_parser:
continue
bpmn_process_id_lookup = BpmnProcessIdLookup.query.filter_by(
bpmn_process_identifier=bpmn_process_identifier
).first()
@ -517,7 +530,7 @@ class ProcessInstanceProcessor:
raise (
ApiError(
code="could_not_find_bpmn_process_identifier",
message="Could not find the the given bpmn process identifier from any sources"
message="Could not find the the given bpmn process identifier from any sources: %s"
% bpmn_process_identifier,
)
)

View File

@ -223,14 +223,14 @@ class ProcessModelService(FileSystemService):
process_groups = []
for item in directory_items:
if item.is_dir() and not item.name[0] == ".":
if item.name == self.REFERENCE_FILES:
continue
elif item.name == self.MASTER_SPECIFICATION:
continue
elif item.name == self.LIBRARY_SPECS:
continue
elif item.name == self.STAND_ALONE_SPECS:
continue
# if item.name == self.REFERENCE_FILES:
# continue
# elif item.name == self.MASTER_SPECIFICATION:
# continue
# elif item.name == self.LIBRARY_SPECS:
# continue
# elif item.name == self.STAND_ALONE_SPECS:
# continue
process_groups.append(self.__scan_process_group(item))
return process_groups

View File

@ -164,7 +164,7 @@ class BaseTest:
data = {"file": (io.BytesIO(file_data), file_name)}
user = self.find_or_create_user()
response = client.post(
f"/v1.0/process-models/{spec.process_group_id}/{spec.id}/file",
f"/v1.0/process-models/{spec.process_group_id}/{spec.id}/files",
data=data,
follow_redirects=True,
content_type="multipart/form-data",