Skip to content

Fix: 1257 - Load ocrd tool json locally#1260

Merged
kba merged 12 commits intomasterfrom
resolve-1257
Aug 1, 2024
Merged

Fix: 1257 - Load ocrd tool json locally#1260
kba merged 12 commits intomasterfrom
resolve-1257

Conversation

@MehmedGIT
Copy link
Copy Markdown
Contributor

A fix for #1257.

Copy link
Copy Markdown
Collaborator

@bertsky bertsky left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Straightforward.

But then perhaps we should make sure that an ocrd-all-tool.json does always exist in any given core installation, independent of our ocrd_all recipes. We could create a default ocrd-all-tool.json (with just the ocrd-dummy processor) as package data. (Which the ocrd_all recipes would merely overwrite in turn.)

@bertsky
Copy link
Copy Markdown
Collaborator

bertsky commented Jul 29, 2024

Oh, the integration tests fail here:

Container ocrd_network_processing_server  Starting
 Container ocrd_network_processing_server  Started
 Container ocrd_network_processing_server  Waiting
 Container ocrd_network_processing_server  Waiting
 Container ocrd_network_processing_server  Error
 Container ocrd_network_processing_server  Error
dependency failed to start: container ocrd_network_processing_server exited (1)
make: *** [Makefile:293: network-integration-test-cicd] Error 1

With no further messages, I suppose this will be hard to reproduce, right?

@MehmedGIT
Copy link
Copy Markdown
Contributor Author

Oh, the integration tests fail here:

Container ocrd_network_processing_server  Starting
 Container ocrd_network_processing_server  Started
 Container ocrd_network_processing_server  Waiting
 Container ocrd_network_processing_server  Waiting
 Container ocrd_network_processing_server  Error
 Container ocrd_network_processing_server  Error
dependency failed to start: container ocrd_network_processing_server exited (1)
make: *** [Makefile:293: network-integration-test-cicd] Error 1

With no further messages, I suppose this will be hard to reproduce, right?

The reason behind this is the missing ocrd-all-tool.json file.

@bertsky
Copy link
Copy Markdown
Collaborator

bertsky commented Jul 29, 2024

The reason behind this is the missing ocrd-all-tool.json file.

Oh, of course!

Then I suggest modifying this PR to include the default ocrd-all-tool.json (with just the dummy processor, which should suffice for dummy-workflow.txt in the integration test) file as package already.

@MehmedGIT
Copy link
Copy Markdown
Contributor Author

The reason behind this is the missing ocrd-all-tool.json file.

Oh, of course!

Then I suggest modifying this PR to include the default ocrd-all-tool.json (with just the dummy processor, which should suffice for dummy-workflow.txt in the integration test) file as package already.

Done. Right before your comment, I have also added a download if it is missing.

@bertsky
Copy link
Copy Markdown
Collaborator

bertsky commented Jul 29, 2024

Done.

Ah, thanks.

I was just thinking about generating this dynamically – basically a json.dump(json.load(open('ocrd-tool.json'))['tools'], 'ocrd-all-tool.json') hooked into cmdclass.build of setup.py...

Right before your comment, I have also added a download if it is missing.

Ok, so we have both mechanisms. I wonder if it wouldn't be better to not support the download strategy anymore...

BTW, now a new CI failure appeared: we get interference from some new paramiko version's stderr chatter about coming deprecations (completely irrevelant to us). Perhaps we can suppress this within our ocrd_logging.conf?

@MehmedGIT
Copy link
Copy Markdown
Contributor Author

MehmedGIT commented Jul 29, 2024

BTW, now a new CI failure appeared

Setting paramiko and paramiko.transport logging to ERROR does not help. I cannot reproduce the error locally, tests pass successfully. The order of the tests seems to mess that up. Changing the file tests/cli/test_bashlib.py to tests/cli/test_processor_bashlib.py should also fix the issue. Even better solution might be writing the output to a file, and reading from the file to verify the output instead of relying on stdout and stderr. There is no new paramiko version. The latest is 3.4.0 and we are still using that version.

@bertsky
Copy link
Copy Markdown
Collaborator

bertsky commented Jul 29, 2024

Setting paramiko and paramiko.transport logging to ERROR does not help.

Indeed – they use the warnings facility instead of logging. See paramiko/paramiko#2419 for a workaround based on a warnings filter.

I cannot reproduce the error locally, tests pass successfully.

It will depend on the venv's (or OS'?) cryptography version.

Changing the file tests/cli/test_bashlib.py to tests/cli/test_processor_bashlib.py should also fix the issue. Even better solution might be writing the output to a file, and reading from the file to verify the output instead of relying on stdout and stderr.

Right – testing for zero stderr was not a good pattern in the first place.

Copy link
Copy Markdown
Member

@kba kba left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Pinning cryptography to an older version is problematic but if paramiko/paramiko#2421 is merged soon, there will probably a proper solution soon.

Ready for merge?

Comment thread src/ocrd_network/constants.py Outdated
MehmedGIT and others added 2 commits July 30, 2024 15:02
Co-authored-by: Konstantin Baierer <kba@users.noreply.github.com>
@kba kba marked this pull request as ready for review July 31, 2024 09:43
@kba kba merged commit 987da9b into master Aug 1, 2024
@kba kba deleted the resolve-1257 branch August 1, 2024 11:27
kba added a commit that referenced this pull request Apr 29, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants