question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Add support for granular timeouts

See original GitHub issue

🚀 Feature

The compiler environment uses timeouts on all operations. These timeouts are controlled by a ConnectionOpts class, which is default-constructed by the constructor. This feature request proposes adding the ability for user code to override these timeouts on a per-method basis by passing in an timeout kwarg to operations that can timeout.

Motivation

Timeout specification is currently very coarse-grained. E.g. ConnectionOpts. rpc_call_max_seconds specifies the timeout of all RPC operations, regardless of what the operation is, the size of the benchmark that is being processed, etc. A timeout that would be suitable for a fast operation like ending a session would be totally unsuitable for a slow operation like applying a long sequence of expensive actions on a large benchmark. Currently the only way to tweak these timeouts to match the different calls is to manually change the env.service.opts fields in between method calls, e.g.:

>>> env = gym.make("llvm-v0", connection_settings=ConnectionOpts(rpc_call_max_seconds=10))
>>> env.reset()
>>> env.connection.opts.rpc_call_max_seconds = 60
>>> env.step(0)
>>> env.connection.opts.rpc_call_max_seconds = 10
>>> env.reset()

Pitch

Add an optional timeout kwarg so that timeouts can be overriden on a per-method basis:

>>> env = gym.make("llvm-v0")
>>> env.reset(timeout=10)
>>> env.step(0, timeout=60)
>>> env.reset(timeout=10)

The following methods would receive this new argument:

  • compiler_gym.envs.CompilerEnv.step
  • compiler_gym.envs.CompilerEnv.multistep
  • compiler_gym.envs.CompilerEnv.reset
  • compiler_gym.envs.CompilerEnv.__init__

All subclasses / wrappers would need to handle this too.

Alternatives

We could also consider ditching the ConnectionOpts class entirely and pushing all of the configurable options out to the individual methods, but I see there are two drawbacks to this approach:

  1. It makes it more difficult to support the use case where we don’t need granular timeout control, e.g. where the usere would just like to specify a longer timeout that can be applied to all operations.
  2. Constructor timeouts would still need to saved so that they can used in fork() to propagate the same settings.

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:6 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
ricardoprinscommented, Jun 1, 2022

Hi @ChrisCummins, I’d like to work on this.

0reactions
ChrisCumminscommented, Jun 9, 2022

Yep, that’s right!

Cheers, Chris

Read more comments on GitHub >

github_iconTop Results From Across the Web

URLFetch does not support granular timeout settings ...
URLFetch does not support granular timeout settings, reverting to total or default URLFetch timeout · python-3.x · python-2.7 · google-app-engine ...
Read more >
Improving request retry options · Issue #14388 - GitHub
Make an option like a dataTransfer timeout variable that gets multiplied by the amount of data being transferred to determine the timeout for ......
Read more >
Maintain Custom Timeouts for Legacy Applications
The following steps describe how apply custom timeouts to applications; to apply custom timeouts to user groups, you can follow the same steps...
Read more >
Setting a Request Timeout for a Spring REST API - Baeldung
Using the Spring MVC request-timeout property is best for setting a global timeout for all requests, but we can also easily define more...
Read more >
About Timeout Policy - Zscaler Help
A timeout policy lets you configure granular rules that control the following: Authentication Timeout: The time interval used to determine when a user...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found