Skip to content
This repository was archived by the owner on Dec 5, 2018. It is now read-only.

Commit 26b83b5

Browse files
authored
Merge pull request #13 from BD2KGenomics/feature/db-env
Feature/db env
2 parents 98b9563 + d48e70c commit 26b83b5

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

luigi-interface/monitor.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ def getTouchfile(bucket_name, touchfile_name):
2424
# Luigi Scraping below
2525
#
2626
def getJobList():
27-
server = os.getenv("LUIGI_SERVER") + ":8082/api/"
27+
server = os.getenv("LUIGI_SERVER") + ":" + os.getenv("LUIGI_PORT", "8082") + "/api/"
2828
#print "SERVER:", server
2929
running_url = server + "task_list?data=%7B%22status%22%3A%22RUNNING%22%2C%22upstream_status%22%3A%22%22%2C%22search%22%3A%22%22%7D"
3030
batch_url = server + "task_list?data=%7B%22status%22%3A%22BATCH_RUNNING%22%2C%22upstream_status%22%3A%22%22%2C%22search%22%3A%22%22%7D"
@@ -84,7 +84,7 @@ def get_consonance_status(consonance_uuid):
8484
# Database initialization, creation if table doesn't exist
8585
#
8686
# Change echo to True to show SQL code... unnecessary
87-
db = create_engine('postgresql://{}:{}@db/monitor'.format(os.getenv("POSTGRES_USER"), os.getenv("POSTGRES_PASSWORD")), echo=False)
87+
db = create_engine('postgresql://{}:{}@db/{}'.format(os.getenv("POSTGRES_USER"), os.getenv("POSTGRES_PASSWORD"), os.getenv("POSTGRES_DB")), echo=False)
8888
conn = db.connect()
8989
metadata = MetaData(db)
9090
luigi = Table('luigi', metadata,
@@ -146,7 +146,7 @@ def get_consonance_status(consonance_uuid):
146146
try:
147147
status_json = get_consonance_status(jsonMetadata['consonance_job_uuid'])
148148
except:
149-
# Add consonance job uuid print t ocstderr,
149+
# Add consonance job uuid print to stderr,
150150
# print job uuid and time when it happeneds
151151
status_json = {
152152
'create_timestamp' : job_dict['start_time'],
@@ -197,11 +197,12 @@ def get_consonance_status(consonance_uuid):
197197
#
198198
# This should be accomplished by:
199199
#
200-
# Select all from the table, pipe it into a list
200+
# Select all from the table, pipe results into a list
201201
#
202202
# for job in list
203203
# consonance status using job.consonance_uuid
204204
# update that job using the information from status return
205+
#
205206
select_query = select([luigi])
206207
select_result = conn.execute(select_query)
207208
result_list = [dict(row) for row in select_result]
@@ -228,6 +229,7 @@ def get_consonance_status(consonance_uuid):
228229
created = status_json['create_timestamp']
229230
updated = status_json['update_timestamp']
230231

232+
# DEBUG to check if state, created, and updated are collected
231233
#print "STATE:", state
232234
#print "CREATED:", created
233235
#print "UPDATED:", updated

0 commit comments

Comments
 (0)