Skip to content

Moja CLI in FLINT Cloud container throws SQL Syntax Errors #5

@gchhablani

Description

@gchhablani

Describe the bug
A clear and concise description of what the bug is.

  • Running the Moja CLI inside GCBM project inside FLINT.cloud container leads to SQL Syntax Errors and few process failures.

To Reproduce
Steps to reproduce the behavior:

  1. Use the following workflow to run Moja CLI:
git clone -b gcbm-container https://github.com/moja-global/flint.cloud
git clone -b gcbm-container https://github.con/moja-global/gcbm.belize
cd gcbm.belize
docker-compose build
docker-compose up -d
docker exec -it gcbm-belize /bin/bash
cd /server/gcbm_project
/opt/gcbm/moja.cli --config_file gcbm_config.cfg --config_provider provider_config.json
  1. There are bunch of SQL Syntax Errors. One of them is shown here:
<2022-02-19 14:25:46.544706> (fatal) - Run(181) - moja.modules.cbm/CBMGrowthModule: /usr/local/src/flint/Source/moja.datarepository/src/providerrelationalsqlite.cpp(55): Throw in function moja::datarepository::SQLiteStatement::SQLiteStatement(const moja::datarepository::SQLiteConnection&, const string&)
Dynamic exception type: boost::wrapexcept<moja::datarepository::QueryException>
std::exception::what: std::exception
[moja::datarepository::tag_sql_error*] = near "(": syntax error
[moja::datarepository::tag_sql*] = SELECT COALESCE(species_id, -1) FROM ( SELECT species_id, RANK() OVER ( PARTITION BY species_id ORDER BY total_volume DESC) AS rank FROM ( SELECT species_id, SUM(merchantable_volume) AS total_volume FROM growth_curve_component gcc INNER JOIN growth_curve_component_value gccv ON gcc.id = gccv.growth_curve_component_id INNER JOIN species s ON gcc.species_id = s.id INNER JOIN forest_type f ON s.forest_type_id = f.id WHERE gcc.growth_curve_id = 1 AND f.name = 'Softwood' ORDER BY gcc.id )) WHERE RANK = 1
  1. See stats, a lot of the tiles are not processed and errors are thrown:
<2022-02-19 14:25:46.552625> (info) -   0:Summary of processing by Tile
<2022-02-19 14:25:46.552689> (info) -   0: Stats level [Tile]: Index [( 26730)]: Time(sec) [Total:     5000, Processed:     1000]: Units [Total:    10000, Processed:        0, NotProcessed:    10000, Errors:      253, LU/second:     1950]
<2022-02-19 14:25:46.552730> (info) -   0: Stats level [Tile]: Index [( 26370)]: Time(sec) [Total:    37000, Processed:    10000]: Units [Total:    10000, Processed:        0, NotProcessed:    10000, Errors:     1832, LU/second:      264]
<2022-02-19 14:25:46.552767> (info) -   0: Stats level [Tile]: Index [( 26010)]: Time(sec) [Total:    30000, Processed:     7000]: Units [Total:    10000, Processed:        0, NotProcessed:    10000, Errors:     1438, LU/second:      325]
<2022-02-19 14:25:46.552803> (info) -   0: Stats level [Tile]: Index [( 25650)]: Time(sec) [Total:        0, Processed:        0]: Units [Total:    10000, Processed:        0, NotProcessed:    10000, Errors:        0, LU/second:    18927]
<2022-02-19 14:25:46.552841> (info) -   0: Stats level [Tile]: Index [( 26731)]: Time(sec) [Total:     2000, Processed:        0]: Units [Total:    10000, Processed:        0, NotProcessed:    10000, Errors:       84, LU/second:     4425]
<2022-02-19 14:25:46.552879> (info) -   0: Stats level [Tile]: Index [( 26371)]: Time(sec) [Total:   110000, Processed:    30000]: Units [Total:    10000, Processed:        0, NotProcessed:    10000, Errors:     5215, LU/second:       90]
<2022-02-19 14:25:46.552915> (info) -   0: Stats level [Tile]: Index [( 26011)]: Time(sec) [Total:   158000, Processed:    42000]: Units [Total:    10000, Processed:        0, NotProcessed:    10000, Errors:     7310, LU/second:       63]
<2022-02-19 14:25:46.552948> (info) -   0: Stats level [Tile]: Index [( 25651)]: Time(sec) [Total:    49000, Processed:    13000]: Units [Total:    10000, Processed:        0, NotProcessed:    10000, Errors:     2188, LU/second:      202]
<2022-02-19 14:25:46.552975> (info) -   0:Summary of processing for full run
<2022-02-19 14:25:46.552999> (info) -   0: Stats level [Global]: Time(sec) [Total:   394000, Processed:   106000]: Units [Total:    80000, Processed:        0, NotProcessed:    80000, Errors:    18320, LU/second:      202]
  1. See error

Expected behavior
My expectation is that the commands execute without any errors and the stats shouldn't have any errors.

Operating Environment:

  • Linux Desktop
  • Ubuntu 20.04, Docker version 20.10.12

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions