Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
ycai
simbricks
Commits
b7178b4b
Unverified
Commit
b7178b4b
authored
Jan 21, 2025
by
Jakob Görgen
Browse files
symphony/client: added timeouts to client calls
parent
d4ad4314
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
10 additions
and
4 deletions
+10
-4
symphony/client/simbricks/client/auth.py
symphony/client/simbricks/client/auth.py
+6
-3
symphony/client/simbricks/client/client.py
symphony/client/simbricks/client/client.py
+2
-1
symphony/client/simbricks/client/opus/base.py
symphony/client/simbricks/client/opus/base.py
+1
-0
symphony/client/simbricks/client/settings.py
symphony/client/simbricks/client/settings.py
+1
-0
No files found.
symphony/client/simbricks/client/auth.py
View file @
b7178b4b
...
...
@@ -83,7 +83,8 @@ class TokenClient:
token
=
None
async
with
aiohttp
.
ClientSession
()
as
session
:
timeout
=
aiohttp
.
ClientTimeout
(
total
=
client_settings
().
timeout_sec
)
async
with
aiohttp
.
ClientSession
(
timeout
=
timeout
)
as
session
:
# get device_code, interval, verification_uri, user_code
device_code
=
None
...
...
@@ -143,7 +144,8 @@ class TokenClient:
assert
old_token
.
is_refresh_valid
()
token
=
None
async
with
aiohttp
.
ClientSession
()
as
session
:
timeout
=
aiohttp
.
ClientTimeout
(
total
=
client_settings
().
timeout_sec
)
async
with
aiohttp
.
ClientSession
(
timeout
=
timeout
)
as
session
:
# get device_code, interval, verification_uri, user_code
async
with
session
.
post
(
...
...
@@ -168,7 +170,8 @@ class TokenClient:
async
def
resource_token
(
self
,
token
:
Token
,
ticket
:
str
)
->
Token
:
assert
token
.
is_access_valid
()
async
with
aiohttp
.
ClientSession
()
as
session
:
timeout
=
aiohttp
.
ClientTimeout
(
total
=
client_settings
().
timeout_sec
)
async
with
aiohttp
.
ClientSession
(
timeout
=
timeout
)
as
session
:
async
with
session
.
post
(
url
=
self
.
_token_url
,
headers
=
{
"Authorization"
:
f
"Bearer
{
token
.
access_token
}
"
},
...
...
symphony/client/simbricks/client/client.py
View file @
b7178b4b
...
...
@@ -58,7 +58,8 @@ class BaseClient:
self
,
overwrite_headers
:
dict
[
str
,
typing
.
Any
]
|
None
=
None
)
->
typing
.
AsyncIterator
[
aiohttp
.
ClientSession
]:
headers
=
await
self
.
_get_headers
(
overwrite_headers
=
overwrite_headers
)
session
=
aiohttp
.
ClientSession
(
headers
=
headers
)
timeout
=
aiohttp
.
ClientTimeout
(
total
=
client_settings
().
timeout_sec
)
session
=
aiohttp
.
ClientSession
(
headers
=
headers
,
timeout
=
timeout
)
try
:
yield
session
finally
:
...
...
symphony/client/simbricks/client/opus/base.py
View file @
b7178b4b
...
...
@@ -30,6 +30,7 @@ import rich
import
rich.color
import
rich.style
import
rich.text
import
rich.console
from
simbricks.orchestration
import
instantiation
,
simulation
,
system
...
...
symphony/client/simbricks/client/settings.py
View file @
b7178b4b
...
...
@@ -32,6 +32,7 @@ class ClientSettings(BaseSettings):
namespace
:
str
=
""
runner_id
:
int
=
-
1
timeout_sec
:
int
=
20
@
lru_cache
def
client_settings
()
->
ClientSettings
:
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment