Skip to content

Commit

Permalink
Merge branch 'master' of github.com:EpistasisLab/penn-ai
Browse files Browse the repository at this point in the history
  • Loading branch information
djfunksalot committed Jun 1, 2017
2 parents ac801bd + ea3cf74 commit e5b6f18
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 3 deletions.
12 changes: 11 additions & 1 deletion ai/ai.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
import json
import pickle
import requests
import urllib.request, urllib.parse
import pdb
import time
import ai.ml_ids
Expand Down Expand Up @@ -110,9 +111,18 @@ def check_results(self,timestamp=None):
#payload.update(self.static_payload)
# get new results
r = requests.post(self.exp_path,data=json.dumps(payload),headers={'content-type': 'application/json'})
# r = requests.post(self.exp_path,data=json.dumps(payload))
baseURL = 'http://hoth.pmacs.upenn.edu:5080'
experimentsURL=baseURL+'/api/experiments'
postvars = {'apikey':'Oed+kIyprDrUq/3oWU5Jpyd22PqhG/CsUvI8oc9l39E='}
params = json.dumps(postvars).encode('utf8')
req = urllib.request.Request(experimentsURL, data=params,
headers={'content-type': 'application/json'})
r = urllib.request.urlopen(req)
data = json.loads(r.read().decode(r.info().get_param('charset') or 'utf-8'))
# if there are new results, return True
pdb.set_trace()
if len(json.loads(r.text)) > 0:
if len(data) > 0:
if self.verbose:
print(time.strftime("%Y %I:%M:%S %p %Z",time.localtime()),
'new results!')
Expand Down
6 changes: 4 additions & 2 deletions tests/extract_ml_experiments.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,11 @@
unixtime = int(datetime.datetime.now().strftime("%s")) * 1000
#last 8 hours
lastupdate = unixtime - (8 * 60 * 60 * 1000 )
baseURL = os.environ['FGLAB_URL']
#baseURL = os.environ['FGLAB_URL']
baseURL = 'http://hoth.pmacs.upenn.edu:5080'
experimentsURL=baseURL+'/api/experiments'
postvars = {'apikey':os.environ['APIKEY'],'date_start':lastupdate}
#postvars = {'apikey':os.environ['APIKEY'],'date_start':lastupdate}
postvars = {'apikey':'Oed+kIyprDrUq/3oWU5Jpyd22PqhG/CsUvI8oc9l39E=','date_start':lastupdate}
params = json.dumps(postvars).encode('utf8')
req = urllib.request.Request(experimentsURL, data=params,
headers={'content-type': 'application/json'})
Expand Down

0 comments on commit e5b6f18

Please sign in to comment.