Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
MPAI-Private
MPAI-CAE
arp
ARP Workflow
Commits
00acb567
Commit
00acb567
authored
May 11, 2023
by
Matteo Spanio
Browse files
update request error handling
parent
0aa52313
Changes
1
Hide whitespace changes
Inline
Side-by-side
client/src/app.py
View file @
00acb567
from
rich.console
import
Console
import
os
from
argparse
import
ArgumentParser
from
time
import
sleep
import
grpc
from
mpai_cae_arp.network
import
arp_pb2
from
mpai_cae_arp.network
import
arp_pb2_grpc
channels
=
{
"AudioAnalyser"
:
grpc
.
insecure_channel
(
"
[::]
:50051"
),
"VideoAnalyser"
:
grpc
.
insecure_channel
(
"
[::]
:50052"
),
"TapeIrregularityClassifier"
:
grpc
.
insecure_channel
(
"
[::]
:50053"
),
"TapeAudioRestoration"
:
grpc
.
insecure_channel
(
"
[::]
:50054"
),
"Packager"
:
grpc
.
insecure_channel
(
"
[::]
:50055"
),
"AudioAnalyser"
:
grpc
.
insecure_channel
(
"
localhost
:50051"
),
"VideoAnalyser"
:
grpc
.
insecure_channel
(
"
localhost
:50052"
),
"TapeIrregularityClassifier"
:
grpc
.
insecure_channel
(
"
localhost
:50053"
),
"TapeAudioRestoration"
:
grpc
.
insecure_channel
(
"
localhost
:50054"
),
"Packager"
:
grpc
.
insecure_channel
(
"
localhost
:50055"
),
}
def
get_args
()
->
tuple
[
str
,
str
]:
...
...
@@ -43,9 +44,15 @@ def run():
packager
=
arp_pb2_grpc
.
AIMStub
(
channels
[
"Packager"
])
request
=
arp_pb2
.
InfoRequest
()
for
aim
in
[
audio_analyser
,
video_analyser
,
tape_irreg_classifier
,
tape_audio_restoration
,
packager
]:
response
=
aim
.
getInfo
(
request
)
console
.
print
(
"[bold]{}[/], v{}"
.
format
(
response
.
title
,
response
.
version
))
try
:
for
aim
in
[
audio_analyser
,
video_analyser
,
tape_irreg_classifier
,
tape_audio_restoration
,
packager
]:
response
=
aim
.
getInfo
(
request
)
console
.
print
(
"[bold]{}[/], v{}"
.
format
(
response
.
title
,
response
.
version
))
sleep
(
0.3
)
except
grpc
.
RpcError
as
e
:
console
.
print
(
"[bold red]Error![/] :boom:"
)
console
.
print
(
f
"[italic red]
{
e
.
details
()
}
[/]"
)
exit
(
69
)
request
=
arp_pb2
.
JobRequest
(
working_dir
=
"/data"
,
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new 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