Skip to content
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

Add ProtocolDAGResult.total_time() convenience method for getting total execution time #450

Open
dotsdl opened this issue Dec 19, 2024 · 0 comments
Labels
enhancement New feature or request good first issue Good for newcomers
Milestone

Comments

@dotsdl
Copy link
Member

dotsdl commented Dec 19, 2024

Currently, to get the total accumulated execution time of a ProtocolDAGResult, one must extract the start and end times of each ProtocolUnitResult and sum them up, like so:

pdr: ProtocolDAGResult
pur: ProtocolUnitResult

time = sum([(pur.end_time - pur.start_time).total_seconds() for pur in pdr.protocol_unit_results])

It would be valuable to have a convenience method, such as ProtocolDAGResult.total_time(), that performs this summation and returns the total time in seconds.

This method could also optionally take a keyword-argument to indicate whether or not to include ProtocolUnitFailures in its summation. If not, it would sum over ProtocolDAGResult.protocol_unit_successesinstead of allprotocol_unit_results`.

@dotsdl dotsdl added this to the Release 1.4 milestone Jan 7, 2025
@dotsdl dotsdl added enhancement New feature or request good first issue Good for newcomers labels Jan 7, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

1 participant