当与主管一起被妖魔化以运行Airbnb / Superset时,没有找到Gunicorn

时间:2016-12-08 00:22:19

标签: python gunicorn supervisor

我正试图妖魔化Superset [https://github.com/airbnb/superset]并使用gunicorn。我使用supervisor,我的配置文件如下所示:

public class ProductDAOImpl implements ProductDAO {
private JdbcTemplate jdbcTemplate;

//private DataSource dataSource;

public ProductDAOImpl(DataSource dataSource) {
    jdbcTemplate = new JdbcTemplate(dataSource);
}

@Override
public List<Product> getAllProducts() {
    String sql = "SELECT * FROM products ORDER BY prod_id\n" +
            "ASC";
    List<Product> productList = jdbcTemplate.query(sql, new RowMapper<Product>() {
        @Override
        public Product mapRow(ResultSet resultSet, int rowNum) throws SQLException {
            Product theProduct = new Product();

            theProduct.setProd_id(resultSet.getInt("prod_id"));
            theProduct.setCategory(resultSet.getInt("category"));
            theProduct.setDescription(resultSet.getString("description"));
            theProduct.setProductName(resultSet.getString("productName"));
            theProduct.setPrice(resultSet.getBigDecimal("price"));
            theProduct.setBrand("brand");

            return theProduct;
        }
    });
    return productList;
}

@Override
public void saveOrUpdate(Product newProduct) {
    if (newProduct.getProd_id() > 0) {
        // update
        String sql = "UPDATE products "
                + "SET category=?, description=?, prod_name=?, price=?, brand=? "
                + "WHERE prod_id=?";

        jdbcTemplate.update(sql, newProduct.getCategory(), newProduct.getDescription(),
                newProduct.getProductName(), newProduct.getPrice(), newProduct.getBrand());
    } else {
        // insert
        String sql = "INSERT INTO products (prod_id, category, description, prod_name, price, brand) "
                + "VALUES (?, ?, ?, ?, ?, ?)";

        jdbcTemplate.update(sql, newProduct.getProd_id(), newProduct.getCategory(), newProduct.getDescription(),
                newProduct.getProductName(), newProduct.getPrice(), newProduct.getBrand());
    }
} }

但是,当我启动主管并运行程序时,我在错误日志文件中收到此错误 [program:superset] command = /usr/local/lib/python2.7/dist-packages/superset/bin/superset runserver directory = /usr/local/lib/python2.7/dist-packages/superset/data/superset environment= PATH='$PATH:/usr/local/lib/python2.7/dist-packages/superset/bin/',PYTHONPATH='$PYTHONPATH:/data/superset' autostart = false autorestart = false startretries = 3 stdout_logfile = /var/log/superset.log stdout_logfile_maxbytes = 100MB stdout_logfile_backups = 5 stderr_logfile = /var/log/superset_err.log stderr_logfile_maxbytes = 100MB stderr_logfile_backups = 5 ,但是当我从命令行运行app straigth时,它可以工作:

/bin/sh: 1: gunicorn: not found

我在跑步

gunicorn -w 4 --timeout 60 -b 0.0.0.0:8081 --limit-request-line 0 --limit-request-field_size 0 superset:app

感谢您的帮助

2 个答案:

答案 0 :(得分:0)

我必须在命令之前显式调用Sudo,即command = sudo /usr/local/lib/python2.7/dist-packages/superset/bin/superset runserver -a 0.0.0.0

答案 1 :(得分:0)

主管无法监控妖魔化过程。主管创建了gunicorn的子进程,然后监视其子进程。