Skip to content

Commit 152aa4f

Browse files
authored
Merge pull request #24 from mapswipe/eric.p.boucher-fix-imports
Fix imports for osgeo and utils
2 parents 6fb2e41 + c67def0 commit 152aa4f

21 files changed

+67
-58
lines changed

.travis.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ python:
66
before_install:
77
# install gdal
88
- sudo bash install_gdal.sh
9+
- cp ./cfg/your_config_file.cfg ./cfg/config.cfg
910
install:
1011
- export CPLUS_INCLUDE_PATH=/usr/include/gdal
1112
- export C_INCLUDE_PATH=/usr/include/gdal

cfg/auth.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
import json
99
import sys
1010

11-
CONFIG_PATH = '../cfg/config.cfg'
11+
CONFIG_PATH = './cfg/config.cfg'
1212

1313
try:
1414
with open(CONFIG_PATH) as f:
@@ -35,7 +35,7 @@ def firebase_admin_auth():
3535
except:
3636
# Default Configuration
3737
print('could not get firebase informtaion from config file')
38-
sys.exit()
38+
sys.exit(1)
3939

4040
# adapt this to your firebase setting
4141
config = {
@@ -59,8 +59,8 @@ def dev_firebase_admin_auth():
5959
service_account = CONFIG['dev_firebase']['service_account']
6060
except:
6161
# Default Configuration
62-
print('could not get firebase dev information from config file')
63-
sys.exit()
62+
print('Could not get firebase dev information from config file.')
63+
sys.exit(1)
6464

6565
# adapt this to your firebase setting
6666
config = {
@@ -83,7 +83,7 @@ def get_api_key(tileserver):
8383
try:
8484
return CONFIG['imagery'][tileserver]
8585
except KeyError:
86-
print("Couldn't find the API key for imagery tileserver {} in {}".format(tileserver, CONFIG_PATH))
86+
print('Could not find the API key for imagery tileserver {} in {}.'.format(tileserver, CONFIG_PATH))
8787
raise
8888

8989

@@ -109,8 +109,8 @@ def __init__(self):
109109
host = CONFIG['mysql']['host']
110110
# print('use configuration for mysql as provided by config.json')
111111
except:
112-
print('we could not load mysql info the config file')
113-
sys.exit()
112+
print('Could not load mysql info from config file.')
113+
sys.exit(1)
114114

115115
self._db_connection = pymysql.connect(
116116
database=dbname,
@@ -155,7 +155,7 @@ def __init__(self):
155155
except:
156156
# Default configuration
157157
print('we could not load mysql dev info from the config file')
158-
sys.exit()
158+
sys.exit(1)
159159

160160
self._db_connection = pymysql.connect(
161161
database=dbname,

cfg/loop_export_module.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "loop_export_module",
3-
"script": "run_export.py",
4-
"cwd": "/data/python-mapswipe-workers/export_module",
3+
"script": "./export_module/run_export.py",
4+
"cwd": "/data/python-mapswipe-workers/",
55
"exec_interpreter": "/data/environments/mapswipe_workers/bin/python3",
66
"log_date_format": "YYYY-MM-DD HH:mm Z",
77
"autorestart": true,

cfg/loop_import_module.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "loop_import_module",
3-
"script": "run_import.py",
4-
"cwd": "/data/python-mapswipe-workers/import_module",
3+
"script": "./import_module/run_import.py",
4+
"cwd": "/data/python-mapswipe-workers/",
55
"exec_interpreter": "/data/environments/mapswipe_workers/bin/python3",
66
"log_date_format": "YYYY-MM-DD HH:mm Z",
77
"autorestart": true,

cfg/loop_transfer_results.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
{
22
"name": "loop_transfer_results_module",
3-
"script": "transfer_results.py",
4-
"cwd": "/data/python-mapswipe-workers/transfer_results_module",
3+
"script": "./transfer_results_module/transfer_results.py",
4+
"cwd": "/data/python-mapswipe-workers",
55
"exec_interpreter": "/data/environments/mapswipe_workers/bin/python3",
66
"log_date_format": "YYYY-MM-DD HH:mm Z",
77
"autorestart": true,
88
"args": ["-l", "-m=1", "-s=60"]
9-
}
9+
}

cfg/loop_update_module.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "loop_update_module",
3-
"script": "run_update.py",
4-
"cwd": "/data/python-mapswipe-workers/update_module",
3+
"script": "./update_module/run_update.py",
4+
"cwd": "/data/python-mapswipe-workers",
55
"exec_interpreter": "/data/environments/mapswipe_workers/bin/python3",
66
"log_date_format": "YYYY-MM-DD HH:mm Z",
77
"autorestart": true,

cfg/your_config_file.cfg

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
"auth_domain": "your_firebase_auth_domain",
1111
"database_url": "your_firebase_database_url",
1212
"storage_bucket": "your_firebase_storage_bucket",
13-
"service_account": "your_firebase_service_account_file"
13+
"service_account": "./cfg/your_firebase_service_account_file"
1414
},
1515
"imagery":{
1616
"bing": "your_bing_api_key",

export_module/export_project_results.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@
1313

1414
import logging
1515
import time
16-
from auth import firebase_admin_auth
17-
from auth import mysqlDB
16+
from cfg.auth import firebase_admin_auth
17+
from cfg.auth import mysqlDB
1818

1919
import argparse
2020
# define arguments that can be passed by the user
@@ -62,23 +62,23 @@ def get_project_results(project_id):
6262
,task_y
6363
,task_z
6464
,avg(result) as decision
65-
,SUM(CASE
65+
,SUM(CASE
6666
WHEN result = 1 THEN 1
6767
ELSE 0
6868
END) AS yes_count
69-
,SUM(CASE
69+
,SUM(CASE
7070
WHEN result = 2 THEN 1
7171
ELSE 0
7272
END) AS maybe_count
73-
,SUM(CASE
73+
,SUM(CASE
7474
WHEN result = 3 THEN 1
7575
ELSE 0
7676
END) AS bad_imagery_count
7777
,wkt
7878
from
7979
results
8080
where
81-
project_id = %s and result > 0
81+
project_id = %s and result > 0
8282
group by
8383
task_id, wkt'''
8484

export_module/export_projects.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313

1414
import logging
1515
import time
16-
from auth import firebase_admin_auth
16+
from cfg.auth import firebase_admin_auth
1717

1818
import argparse
1919
# define arguments that can be passed by the user

export_module/export_users_and_stats.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313

1414
import logging
1515
import time
16-
from auth import firebase_admin_auth
16+
from cfg.auth import firebase_admin_auth
1717

1818
import argparse
1919
# define arguments that can be passed by the user

0 commit comments

Comments
 (0)