Git Product home page Git Product logo

camera-trap-calculation's Introduction

camera-trap-calculation

目的

將 R 的計算程式轉成 Python,並且使用 Flask 製作成 RESTful API。

檔案位置

  • R 程式碼放在 ./from-mai 資料夾。
  • Python 計算程式放在 ./flaskr/scripts/NOEveryThing
  • Flask API 為 ./flaskr/app.py

採用 Flask 官方建議的 Project Layout

Deploy

部署的工具

原因有

  • 配置簡單。
  • 輕便佔的容量不大。
  • 與 Python 相容性佳。
  • 使用人數多,有問題比較好解決。

配置文件

位置在 /etc/supervisor.conf

[program:flask]
command=gunicorn -w4 -b10.0.10.31:80 app:app     # 執行 gunicorn 命令
startsecs=0-                                     # 啟動程式多少秒之後判斷狀態
stopwaitsecs=0                                   # 程式等待時間,若超過這個秒數則自動取消
autostart=true                                   # 自動開啟
autorestart=true                                 # 程式異常退出後是否重啟
stdout_logfile=/tmp/gunicorn.log                 # log 檔案位置
stderr_logfile=/tmp/gunicorn.err                 # error log 檔案位置

詳細的配置可以參考 Supervisor Docs

常用指令

$ supervisord -c /etc/supervisor.conf    # 使用 supervisor.conf 的配置
$ ps aux | grep supervisord              # 查看目前執行的排程
$ supervisorctl status                   # 查看目前狀態 
$ supervisorctl stop flask               # 停止配置文件上定義的程序
$ supervisorctl start flask              # 開啟止配置文件上定義的程序
$ supervisorctl restart flask            # 重啟配置文件上定義的程序
$ supervisorctl update                   # 重新更新

參考文獻

camera-trap-calculation's People

Contributors

siansiansu avatar

Watchers

moogoo avatar Chihjen Ko avatar James Cloos avatar Kelp avatar tinym avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.