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
Video Analyzer
Commits
bccb2259
Commit
bccb2259
authored
Apr 17, 2023
by
Matteo
Browse files
update
parent
416813c8
Changes
1
Hide whitespace changes
Inline
Side-by-side
server.py
View file @
bccb2259
...
...
@@ -3,6 +3,7 @@ import subprocess
from
concurrent
import
futures
from
typing
import
Any
,
Callable
import
grpc
import
time
from
grpc
import
StatusCode
from
rich.console
import
Console
...
...
@@ -90,14 +91,16 @@ class VideoAnalyserServicer(arp_pb2_grpc.AIMServicer):
'--speed'
,
'7.5'
]
process
=
subprocess
.
run
(
prog
,
stdout
=
subprocess
.
PIPE
,
stderr
=
subprocess
.
PIPE
,
check
=
True
)
console
.
print
(
process
.
stderr
)
for
line
in
process
.
stdout
:
message
=
line
.
decode
(
'utf-8'
).
strip
()
console
.
log
(
message
)
yield
JobResponse
(
status
=
"success"
,
message
=
message
)
with
subprocess
.
Popen
(
prog
)
as
process
:
yield
JobResponse
(
status
=
"success"
,
message
=
"Process started"
)
yield
JobResponse
(
status
=
"success"
,
message
=
"Process finished"
)
# wait for the process to finish and get its return code
# return_code = process.wait()
# self.console.log('Process finished with return code:', return_code)
# yield JobResponse(status="success", message=f'Process finished with return code: {return_code}')
def
serve
(
console
):
...
...
@@ -112,15 +115,3 @@ if __name__ == '__main__':
console
=
Console
()
console
.
print
(
'Server started at localhost:50052 :satellite:'
)
serve
(
console
)
# working_dir = os.path.abspath('../data')
# prog = [
# 'bin/video_analyser',
# '--working-path', working_dir,
# '--files-name', 'BERIO100.mov',
# '--brands', 'true',
# '--speed', '7.5'
# ]
# process = subprocess.run(prog, check=True)
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