-
Notifications
You must be signed in to change notification settings - Fork 32
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Test for ocrd-network #1184
Merged
Merged
Test for ocrd-network #1184
Changes from all commits
Commits
Show all changes
27 commits
Select commit
Hold shift + click to select a range
eb0da74
Add a test for workflow run in ocrd_all
joschrew 79c5b79
remove duplicates
MehmedGIT 3d501b5
Make make assets in Dockerfile skipable
joschrew 7f77b57
Add a test for workflow run in ocrd_all
joschrew 9cdb222
remove duplicates
MehmedGIT 419a535
Make make assets in Dockerfile skipable
joschrew a55d961
Merge branch 'test-workflow' of github.com:OCR-D/core into test-workflow
MehmedGIT cb8cde7
merge master
MehmedGIT dfd78d5
make ocrd all tests callable from Makefile
MehmedGIT 14576cf
update actions and add python 3.12
34459e0
update actions and add python 3.12
7d119aa
update actions
2a7ef7b
Remove ocrd_all-tests from core makefile
joschrew 3effd63
ci: disable scrutinizer build
kba 8dae53d
bashlib input-files: apply download_file on each input_file
bertsky 0195099
bashlib input-files: let None pass through
bertsky feee374
scrutinizer: try to fix py version
bertsky 48d52e3
:memo: changelog
kba 71ec3a2
Merge branch 'master' into update/workflows
kba c8f41a5
drop distutils, support python 3.12
kba b788b59
:memo: changelog
kba df77ace
Merge branch 'master' into update/workflows
kba cf4664a
disable ocrd all test in core
MehmedGIT e88d646
:memo: changelog
kba 6ecbaa8
make network-integration-test: disable ocrd_all test
kba f714742
Merge branch 'master' into test-workflow
kba 1bd8fc4
ci: fix integration test
kba File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
from src.ocrd_network.constants import JobState | ||
from tests.network.config import test_config | ||
from tests.network.utils import poll_till_timeout_fail_or_success, post_ps_workflow_request | ||
|
||
PROCESSING_SERVER_URL = test_config.PROCESSING_SERVER_URL | ||
|
||
|
||
def test_ocrd_all_workflow(): | ||
# This test is supposed to run with ocrd_all not with just core on its own | ||
# Note: the used workflow path is volume mapped | ||
path_to_wf = "/ocrd-data/assets/ocrd_all-test-workflow.txt" | ||
path_to_mets = "/data/mets.xml" | ||
wf_job_id = post_ps_workflow_request(PROCESSING_SERVER_URL, path_to_wf, path_to_mets) | ||
job_state = poll_till_timeout_fail_or_success( | ||
test_url=f"{PROCESSING_SERVER_URL}/workflow/job-simple/{wf_job_id}", | ||
tries=30, | ||
wait=10 | ||
) | ||
assert job_state == JobState.success |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
from requests import get as request_get, post as request_post | ||
from time import sleep | ||
from src.ocrd_network.constants import JobState | ||
|
||
|
||
def poll_till_timeout_fail_or_success(test_url: str, tries: int, wait: int) -> JobState: | ||
job_state = JobState.unset | ||
while tries > 0: | ||
sleep(wait) | ||
response = request_get(url=test_url) | ||
assert response.status_code == 200, f"Processing server: {test_url}, {response.status_code}" | ||
job_state = response.json()["state"] | ||
if job_state == JobState.success or job_state == JobState.failed: | ||
break | ||
tries -= 1 | ||
return job_state | ||
|
||
|
||
def post_ps_processing_request(ps_server_host: str, test_processor: str, test_job_input: dict) -> str: | ||
test_url = f"{ps_server_host}/processor/run/{test_processor}" | ||
response = request_post( | ||
url=test_url, | ||
headers={"accept": "application/json"}, | ||
json=test_job_input | ||
) | ||
# print(response.json()) | ||
# print(response.__dict__) | ||
assert response.status_code == 200, f"Processing server: {test_url}, {response.status_code}" | ||
processing_job_id = response.json()["job_id"] | ||
assert processing_job_id | ||
return processing_job_id | ||
|
||
|
||
# TODO: Can be extended to include other parameters such as page_wise | ||
def post_ps_workflow_request(ps_server_host: str, path_to_test_wf: str, path_to_test_mets: str) -> str: | ||
test_url = f"{ps_server_host}/workflow/run?mets_path={path_to_test_mets}&page_wise=True" | ||
response = request_post( | ||
url=test_url, | ||
headers={"accept": "application/json"}, | ||
files={"workflow": open(path_to_test_wf, "rb")} | ||
) | ||
# print(response.json()) | ||
# print(response.__dict__) | ||
assert response.status_code == 200, f"Processing server: {test_url}, {response.status_code}" | ||
wf_job_id = response.json()["job_id"] | ||
assert wf_job_id | ||
return wf_job_id |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would expect
SKIP_ASSETS=0
to disable the behavior. Did you meantest $SKIP_ASSETS -eq 1
?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think
SKIP_ASSETS
should be renamed toMAKE_ASSETS
to reverse the logic.SKIP_ASSETS
itself has a negative meaning. False to False makes True.SKIP_ASSETS=1 (true) -> do not make assets
SKIP_ASSETS=0 (false) -> make assets
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
for me 0 is false so if
SKIP_ASSETS
is 0 then it is not skipped.