Skip to content
This repository has been archived by the owner on Dec 19, 2023. It is now read-only.

Commit

Permalink
Merge pull request #43 from numerai/pschork/fix-sibmission-status
Browse files Browse the repository at this point in the history
Pass model_id to submission status
  • Loading branch information
pschork committed May 10, 2020
2 parents 9f07ea4 + d4f330d commit d80b3e5
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 12 deletions.
23 changes: 14 additions & 9 deletions numerox/numerai.py
Original file line number Diff line number Diff line change
Expand Up @@ -117,13 +117,13 @@ def upload(filename,
tournament=tournament,
model_id=model_id)
if block:
status = status_block(upload_id, public_id, secret_key)
status = status_block(upload_id, public_id, secret_key, model_id=model_id)
else:
status = upload_status(upload_id, public_id, secret_key)
status = upload_status(upload_id, public_id, secret_key, model_id=model_id)
break

except: # noqa
print('upload failed')
except Exception as e: # noqa
print('upload failed - %s' % e)
time.sleep(sleep_seconds)
count += 1

Expand All @@ -133,12 +133,12 @@ def upload(filename,
return upload_id, status


def upload_status(upload_id, public_id, secret_key):
def upload_status(upload_id, public_id, secret_key, model_id=None):
"Dictionary containing the status of upload"
napi = NumerAPI(public_id=public_id,
secret_key=secret_key,
verbosity='warning')
status_raw = napi.submission_status(upload_id)
status_raw = napi.submission_status(upload_id, model_id=model_id)
status = {}
for key, value in status_raw.items():
if isinstance(value, dict):
Expand All @@ -147,7 +147,7 @@ def upload_status(upload_id, public_id, secret_key):
return status


def status_block(upload_id, public_id, secret_key, verbose=True):
def status_block(upload_id, public_id, secret_key, verbose=True, model_id=None):
"""
Block until status completes; then return status dictionary.
Expand All @@ -159,12 +159,17 @@ def status_block(upload_id, public_id, secret_key, verbose=True):
seen = []
fmt_f = "{:<19} {:>9.4f} {:<.4f}"
fmt_b = "{:<19} {:>9} {:<.4f}"
while True:
status = upload_status(upload_id, public_id, secret_key)
n_tries = 3
count = 0
while count < n_tries:
count += 1
status = upload_status(upload_id, public_id, secret_key, model_id=model_id)
t = time.time()
for key, value in status.items():
if value is not None and key not in seen:
seen.append(key)
if key == 'filename':
continue
minutes = (t - t0) / 60
if verbose:
if key in ('originality', 'concordance'):
Expand Down
2 changes: 1 addition & 1 deletion numerox/version.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = "4.1.3"
__version__ = "4.1.4"
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@ scipy
pandas
tables
scikit-learn
numerapi >= 2.2.0
numerapi >= 2.2.2
nose
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ def get_version_str():
'pandas',
'tables',
'scikit-learn',
'numerapi',
'numerapi>=2.2.2',
'nose']


Expand Down

0 comments on commit d80b3e5

Please sign in to comment.