Permalink
Browse files

Make faster detection backend as systemd service.

Signed-off-by: Bofu Chen (bafu) <bofu@dt42.io>
  • Loading branch information...
Bofu Chen (bafu)
Bofu Chen (bafu) committed Sep 23, 2017
1 parent e75b6eb commit 465221d304afd8f69dce4e38b7b387654b819f3d
@@ -33,10 +33,10 @@ fi

case $1 in
start | stop | status)
sudo systemctl $1 detection_server.service agent.service broker.service dashboard.service localimg.service camera.service journal.service cleaner.timer
sudo systemctl $1 detection_fast_server.service agent.service broker.service dashboard.service localimg.service camera.service journal.service cleaner.timer
;;
log)
sudo journalctl -x --no-pager -u detection_server.service
sudo journalctl -x --no-pager -u detection_fast_server.service
sudo journalctl -x --no-pager -u agent.service
sudo journalctl -x --no-pager -u broker.service
sudo journalctl -x --no-pager -u dashboard.service
@@ -92,12 +92,11 @@ install_darknet() {
popd > /dev/null
popd > /dev/null

# detection backend
# build detection backend (darknet)
pushd inference > /dev/null
git clone https://github.com/thomaspark-pkj/darknet-nnpack.git darknet
pushd darknet > /dev/null
patch -p 1 < ../../patch/01-detection-backend.patch
patch -p 1 < ../../patch/02-detection-utilities.patch
make -j
popd > /dev/null
popd > /dev/null
@@ -73,23 +73,8 @@ client.on('message', (t, m) => {
// Listen to classifier/detector's result done file. When result done
// file (.txt.done) is created, result is available.
var watcher = fs.watch(inference_server_img_dir, (eventType, filename) => {
/* Merge inference result and snapshot into single image. */
if (eventType === 'change') {
if (eventType === 'rename') {
if (filename === (snapshot + '.txt.done')) {
/*
fs.open(resultfile_path, 'r', (err, fd) => {
if (err) {
if (err.code === 'ENOENT') {
console.error(resultfile_path + ' does not exist');
return;
}
throw err;
}
readMyData(fd);
});
*/

fs.readFile(resultfile_path, (err, result) => {
if (err) throw err

@@ -110,12 +95,12 @@ client.on('message', (t, m) => {
client.publish(topicDashboardInferenceResult, result.toString().replace(/(\n)+/g, '<br />'));
})
} else {
console.log('Detect change of ' + filename + ', but comparing target is ' + snapshot + '.txt.done');
console.log('rename event for ' +
filename +
', but it is not inference result done file.');
}
} else if (eventType == 'rename') {
console.log('watch get rename event for ' + filename);
} else {
console.log('watch get unknown event, ' + eventType);
console.log(eventType + ' event for ' + filename + ', ignore it.');
}
});
});

This file was deleted.

Oops, something went wrong.
@@ -0,0 +1,15 @@
[Unit]
Description=detection server
After=network.target

[Service]
Type=simple
WorkingDirectory=/usr/local/berrynet/inference/darknet
PIDFile=/tmp/detection_server.pid
ExecStart=/bin/bash utils/localrun.sh /var/ramfs
Restart=always
RestartSec=10

[Install]
WantedBy=multi-user.target
WantedBy=graphical.target
Oops, something went wrong.

0 comments on commit 465221d

Please sign in to comment.