-
Notifications
You must be signed in to change notification settings - Fork 32
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #921 from hdoupe/outputs
Merged #921
- Loading branch information
Showing
170 changed files
with
2,237 additions
and
12,442 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
msgpack | ||
celery | ||
redis | ||
pytest | ||
flask | ||
toolz |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
|
||
pushd ../Tax-Calculator && conda env create && source activate taxcalc-dev && pip install -e . && popd | ||
pushd ../B-Tax && pip install -e . && popd | ||
pip install -r requirements.txt | ||
pip install -e . |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
import pytest | ||
from celery import chord | ||
|
||
from api.celery_tasks import (taxbrain_elast_async, | ||
taxbrain_elast_postprocess, | ||
dropq_task_small_async, | ||
taxbrain_postprocess) | ||
|
||
@pytest.fixture(scope='session') | ||
def celery_config(): | ||
return { | ||
'broker_url': 'redis://localhost:6379', | ||
'result_backend': 'redis://localhost:6379', | ||
'task_serializer': 'json', | ||
'accept_content': ['msgpack', 'json']} | ||
|
||
def test_elast_endpoint(celery_worker): | ||
elast_params = { | ||
'year_n': 1, | ||
'user_mods': { | ||
'policy': {2017: {'_FICA_ss_trt': [0.1]}}, | ||
'behavior': {}, | ||
'growdiff_response': {}, | ||
'consumption': {}, | ||
'growdiff_baseline': {}, | ||
'growmodel': {}}, | ||
'gdp_elasticity': 0.3, | ||
'use_puf_not_cps': False, | ||
'start_year': 2017, | ||
'use_full_sample':True, | ||
'return_dict': True | ||
} | ||
|
||
inputs = [] | ||
for i in range(0, 3): | ||
inputs.append(dict(elast_params, **{'year_n': i})) | ||
compute_task = taxbrain_elast_async | ||
postprocess_task = taxbrain_elast_postprocess | ||
result = (chord(compute_task.signature(kwargs=i, serializer='msgpack') | ||
for i in inputs))(postprocess_task.signature( | ||
serializer='msgpack')) | ||
print(result.get()) | ||
|
||
|
||
def test_taxbrain_endpoint(celery_worker): | ||
tc_params = { | ||
'user_mods': { | ||
"policy": { | ||
2017: {"_FICA_ss_trt": [0.1]}}, | ||
"consumption": {}, | ||
"behavior": {}, | ||
"growdiff_baseline": {}, | ||
"growdiff_response": {}, | ||
"growmodel": {} | ||
}, | ||
'start_year': 2017, | ||
'use_puf_not_cps': False, | ||
'year_n': 0 | ||
} | ||
|
||
inputs = [] | ||
for i in range(0, 3): | ||
inputs.append(dict(tc_params, **{'year_n': i})) | ||
compute_task = dropq_task_small_async | ||
postprocess_task = taxbrain_postprocess | ||
result = (chord(compute_task.signature(kwargs=i, serializer='msgpack') | ||
for i in inputs))(postprocess_task.signature( | ||
serializer='msgpack')) | ||
print(result.get()) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,4 +5,5 @@ toolz | |
celery | ||
requests-mock | ||
requests | ||
msgpack | ||
pytest |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -28,3 +28,4 @@ python-dateutil | |
toolz | ||
whitenoise | ||
msgpack | ||
dataclasses # This will not be needed with Python >=3.7 |
Oops, something went wrong.