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
from
rich.console
import
Console
import
os
import
os
from
argparse
import
ArgumentParser
from
argparse
import
ArgumentParser
from
time
import
sleep
import
grpc
import
grpc
from
mpai_cae_arp.network
import
arp_pb2
from
mpai_cae_arp.network
import
arp_pb2
from
mpai_cae_arp.network
import
arp_pb2_grpc
from
mpai_cae_arp.network
import
arp_pb2_grpc
channels
=
{
channels
=
{
"AudioAnalyser"
:
grpc
.
insecure_channel
(
"
[::]
:50051"
),
"AudioAnalyser"
:
grpc
.
insecure_channel
(
"
localhost
:50051"
),
"VideoAnalyser"
:
grpc
.
insecure_channel
(
"
[::]
:50052"
),
"VideoAnalyser"
:
grpc
.
insecure_channel
(
"
localhost
:50052"
),
"TapeIrregularityClassifier"
:
grpc
.
insecure_channel
(
"
[::]
:50053"
),
"TapeIrregularityClassifier"
:
grpc
.
insecure_channel
(
"
localhost
:50053"
),
"TapeAudioRestoration"
:
grpc
.
insecure_channel
(
"
[::]
:50054"
),
"TapeAudioRestoration"
:
grpc
.
insecure_channel
(
"
localhost
:50054"
),
"Packager"
:
grpc
.
insecure_channel
(
"
[::]
:50055"
),
"Packager"
:
grpc
.
insecure_channel
(
"
localhost
:50055"
),
}
}
def
get_args
()
->
tuple
[
str
,
str
]:
def
get_args
()
->
tuple
[
str
,
str
]:
...
@@ -43,9 +44,15 @@ def run():
...
@@ -43,9 +44,15 @@ def run():
packager
=
arp_pb2_grpc
.
AIMStub
(
channels
[
"Packager"
])
packager
=
arp_pb2_grpc
.
AIMStub
(
channels
[
"Packager"
])
request
=
arp_pb2
.
InfoRequest
()
request
=
arp_pb2
.
InfoRequest
()
for
aim
in
[
audio_analyser
,
video_analyser
,
tape_irreg_classifier
,
tape_audio_restoration
,
packager
]:
try
:
response
=
aim
.
getInfo
(
request
)
for
aim
in
[
audio_analyser
,
video_analyser
,
tape_irreg_classifier
,
tape_audio_restoration
,
packager
]:
console
.
print
(
"[bold]{}[/], v{}"
.
format
(
response
.
title
,
response
.
version
))
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
(
request
=
arp_pb2
.
JobRequest
(
working_dir
=
"/data"
,
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