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

Commit

Permalink
Merge pull request #44 from QuPengfei/va-fps-01
Browse files Browse the repository at this point in the history
add prefix for the VA service machine name
  • Loading branch information
dpatel257 authored Jul 31, 2019
2 parents d7ad3b3 + 46b6e08 commit 54de5ce
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions ad-insertion/video-analytics-service/feeder/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
video_analytic_url = "http://localhost:8080/pipelines/"
timeout = 30
sleep_for_status = 0.1
machine_prefix="va"

analytic_rest_msg_template = {
"source": {
Expand All @@ -36,15 +37,15 @@
}

def send_video_analytics_fps(fps):
if fps <= 0:
if fps < 0:
return
global p
if not p:
p=Producer()
if p:
p.send(video_analytics_fps_topic, json.dumps({
"fps": fps,
"machine":socket.gethostname()[0:3],
"machine":machine_prefix+socket.gethostname()[0:3],
"time": datetime.datetime.utcnow().isoformat(),
}));

Expand Down Expand Up @@ -129,12 +130,11 @@ def process_stream(streamstring):
time.sleep(sleep_for_status)
status, fps = get_analytic_status(instanceid.strip(), pipeline)
print("VA feeder: segment status : " + status, flush=True)
send_video_analytics_fps(fps)
if status == 'COMPLETED':
send_video_analytics_fps(fps)
zk.process_end()
break
elif status == 'RUNNING':
send_video_analytics_fps(fps)
continue
elif status == 'QUEUED':
continue
Expand Down

0 comments on commit 54de5ce

Please sign in to comment.