Skip to content
This repository was archived by the owner on Dec 16, 2024. It is now read-only.

Commit 54de5ce

Browse files
author
dpatel257
authored
Merge pull request #44 from QuPengfei/va-fps-01
add prefix for the VA service machine name
2 parents d7ad3b3 + 46b6e08 commit 54de5ce

File tree

1 file changed

+4
-4
lines changed
  • ad-insertion/video-analytics-service/feeder

1 file changed

+4
-4
lines changed

ad-insertion/video-analytics-service/feeder/main.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
video_analytic_url = "http://localhost:8080/pipelines/"
2323
timeout = 30
2424
sleep_for_status = 0.1
25+
machine_prefix="va"
2526

2627
analytic_rest_msg_template = {
2728
"source": {
@@ -36,15 +37,15 @@
3637
}
3738

3839
def send_video_analytics_fps(fps):
39-
if fps <= 0:
40+
if fps < 0:
4041
return
4142
global p
4243
if not p:
4344
p=Producer()
4445
if p:
4546
p.send(video_analytics_fps_topic, json.dumps({
4647
"fps": fps,
47-
"machine":socket.gethostname()[0:3],
48+
"machine":machine_prefix+socket.gethostname()[0:3],
4849
"time": datetime.datetime.utcnow().isoformat(),
4950
}));
5051

@@ -129,12 +130,11 @@ def process_stream(streamstring):
129130
time.sleep(sleep_for_status)
130131
status, fps = get_analytic_status(instanceid.strip(), pipeline)
131132
print("VA feeder: segment status : " + status, flush=True)
133+
send_video_analytics_fps(fps)
132134
if status == 'COMPLETED':
133-
send_video_analytics_fps(fps)
134135
zk.process_end()
135136
break
136137
elif status == 'RUNNING':
137-
send_video_analytics_fps(fps)
138138
continue
139139
elif status == 'QUEUED':
140140
continue

0 commit comments

Comments
 (0)