Skip to content

Add timeout to the API and update API versioning#366

Merged
jbreue16 merged 11 commits intocadet:masterfrom
sleweke-bayer:feature/api_timeout
Apr 13, 2026
Merged

Add timeout to the API and update API versioning#366
jbreue16 merged 11 commits intocadet:masterfrom
sleweke-bayer:feature/api_timeout

Conversation

@sleweke-bayer
Copy link
Copy Markdown
Contributor

@sleweke-bayer sleweke-bayer commented Feb 21, 2025

Adds a timeout implemented as a callback.
The timeout is exposed as an API method and as a field in the file format (/input/solver/TIMEOUT).
The new function is exposed as part of another API version 1.1.0a1, while 1.0.0 is maintained. This is the first time we actually support multiple APIs.
Companion CADET-Python PR: cadet/CADET-Python#71, which adds support of the new API function and implements multi API version support

Fixes #351

Follow-ups:

@jbreue16
Copy link
Copy Markdown
Contributor

I guess the next step is for @schmoelder to test this?

@schmoelder
Copy link
Copy Markdown
Contributor

Hey, first of all, thanks again for adding this feature and sorry for taking so long to test and review it.

Admittedly, the modification of the C-API has made things a bit more cumbersome than expected, leading to a segfault in CADET-Python.

Maybe I misunderstood @sleweke-bayer, but I was under the impression that this change would still be backward compatible, meaning older versions of CADET-Python should still be able to use it, right?

If that's not the case, I propose we revert the changes to the C-API and, for now, only allow specifying a timeout via the configuration.

Once we have a better system to maintain different versions of the C-API without crashing everything, we can still add this feature again later.

But I might be wrong. Hopefully, this didn't cause too much work.

@jbreue16
Copy link
Copy Markdown
Contributor

This PR only needs to be tested, for which we need cadet/CADET-Python#71 to be finished by @AntoniaBerger, and then we can merge this

@codecov
Copy link
Copy Markdown

codecov Bot commented Apr 9, 2026

@jbreue16 jbreue16 changed the title Add timeout to the API Add timeout to the API and update API versioning Apr 9, 2026
@jbreue16
Copy link
Copy Markdown
Contributor

jbreue16 commented Apr 9, 2026

Since this PR has been open for so long, Ive created the follow up issue

and will merge this PR once

sleweke-bayer and others added 9 commits April 9, 2026 17:00
Adds a timeout for simulations that is implemented as a callback.
Notifications are now also sent whenever a linear system is solved,
which occurs during Newton iteration.

The timeout is exposed via the C-API.
Adds a dedicated return code for situations where the
underlying simulator has not been initialized before
calling the API method.
Add a MultiCallback that calls multiple sub-callbacks. Moves callback
handling to the Driver to avoid duplication.
@jbreue16 jbreue16 force-pushed the feature/api_timeout branch 3 times, most recently from 6c36369 to c800b1d Compare April 13, 2026 14:26
@jbreue16 jbreue16 force-pushed the feature/api_timeout branch from 0dba927 to f0765ae Compare April 13, 2026 18:45
@jbreue16
Copy link
Copy Markdown
Contributor

I dont know how to add a test for this because of Logging issues, see #667

Ill merge this and we will add the test in our dev-call

@jbreue16 jbreue16 merged commit 781fea3 into cadet:master Apr 13, 2026
5 of 7 checks passed
@github-project-automation github-project-automation Bot moved this from Todo to Done in CADET Repositories Apr 13, 2026
@github-actions github-actions Bot locked and limited conversation to collaborators Apr 13, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

Support timeout for running simulations with C-API

4 participants