Skip to content

Commit

Permalink
Fix 98 collection only param (#101)
Browse files Browse the repository at this point in the history
* using pywps 4.2.10

* fix formatting

* added test for subset with collection only

* fix subset_wf_3.json test file
  • Loading branch information
cehbrecht committed Feb 2, 2021
1 parent 5a2e908 commit 5f435c2
Show file tree
Hide file tree
Showing 7 changed files with 59 additions and 7 deletions.
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
pywps>=4.2.9,<4.3
pywps>=4.2.10,<4.3
jinja2
click
psutil
Expand Down
1 change: 0 additions & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,6 @@
include_package_data=True,
install_requires=[
reqs,
"pywps @ git+https://github.com/geopython/pywps.git@pywps-4.2",
"daops @ git+https://github.com/roocs/daops.git",
"clisops @ git+https://github.com/roocs/clisops.git",
"roocs-utils @ git+https://github.com/roocs/roocs-utils.git",
Expand Down
9 changes: 9 additions & 0 deletions tests/test_workflow.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
TREE_WF_4 = resource_file("subset_wf_4.json")
TREE_WF_5 = resource_file("subset_wf_5.json")
TREE_WF_6 = resource_file("subset_wf_6.json")
TREE_WF_COL_ONLY = resource_file("subset_wf_collection_only.json")


def test_validate_tree_wf():
Expand Down Expand Up @@ -88,9 +89,17 @@ def test_run_tree_wf_6():
wfdoc = workflow.load_wfdoc(TREE_WF_6)
wf = workflow.TreeWorkflow(output_dir=tempfile.mkdtemp())
output = wf.run(wfdoc)
assert 'https://data.mips.copernicus-climate.eu/thredds/fileServer/esg_c3s-cmip6' in output[0]
assert "zostoga_mon_inmcm4_rcp45_r1i1p1_20850116-21001216.nc" in output[0]


def test_run_tree_wf_collection_only():
wfdoc = workflow.load_wfdoc(TREE_WF_COL_ONLY)
wf = workflow.TreeWorkflow(output_dir=tempfile.mkdtemp())
output = wf.run(wfdoc)
assert "rlds_Amon_IPSL-CM6A-LR_historical_r1i1p1f1_gr_18500116-20141216.nc" in output[0]


def test_workflow_runner_tree():
wf = workflow.WorkflowRunner(output_dir=tempfile.mkdtemp())
output = wf.run(TREE_WF_4)
Expand Down
15 changes: 15 additions & 0 deletions tests/test_wps_orchestrate.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,18 @@ def test_wps_orchestrate():
)
assert_response_success(resp)
assert "meta4" in get_output(resp.xml)["output"]


def test_wps_orchestrate_subset_collection_only():
client = client_for(Service(processes=[Orchestrate()], cfgfiles=[PYWPS_CFG]))
datainputs = "workflow=@xlink:href=file://{0}".format(
resource_file("subset_wf_collection_only.json")
)
resp = client.get(
"?service=WPS&request=Execute&version=1.0.0&identifier=orchestrate&datainputs={}".format(
datainputs
)
)

assert_response_success(resp)
assert "meta4" in get_output(resp.xml)["output"]
12 changes: 12 additions & 0 deletions tests/test_wps_subset.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,18 @@ def test_wps_subset_cmip6_original_files():
assert "meta4" in get_output(resp.xml)["output"]


def test_wps_subset_cmip6_collection_only():
client = client_for(Service(processes=[Subset()], cfgfiles=[PYWPS_CFG]))
datainputs = "collection=CMIP6.CMIP.IPSL.IPSL-CM6A-LR.historical.r1i1p1f1.Amon.rlds.gr.v20180803"
resp = client.get(
"?service=WPS&request=Execute&version=1.0.0&identifier=subset&datainputs={}".format(
datainputs
)
)
assert_response_success(resp)
assert "meta4" in get_output(resp.xml)["output"]


def test_wps_subset_missing_collection():
client = client_for(Service(processes=[Subset()], cfgfiles=[PYWPS_CFG]))
# datainputs = "collection=c3s-cmip5.output1.ICHEC.EC-EARTH.historical.day.atmos.day.r1i1p1.tas.latest"
Expand Down
10 changes: 5 additions & 5 deletions tests/testdata/subset_wf_3.json
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
{
'doc': "tree workflow with diff operator",
'inputs': {
'inm': ['cmip5.output1.INM.inmcm4.rcp45.mon.ocean.Omon.r1i1p1.latest.zostoga'],
'mpi': ['cmip5.output1.MPI-M.MPI-ESM-LR.rcp45.mon.ocean.Omon.r1i1p1.latest.zostoga']
"doc": "tree workflow with diff operator",
"inputs": {
"inm": ["cmip5.output1.INM.inmcm4.rcp45.mon.ocean.Omon.r1i1p1.latest.zostoga"],
"mpi": ["cmip5.output1.MPI-M.MPI-ESM-LR.rcp45.mon.ocean.Omon.r1i1p1.latest.zostoga"]
},
"outputs": {
"output": "diff/output"
},
'steps': {
"steps": {
"subsetA": {
"run": "subset",
"in": {
Expand Down
17 changes: 17 additions & 0 deletions tests/testdata/subset_wf_collection_only.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{
"doc": "subset collection only",
"inputs": {
"rlds": ["CMIP6.CMIP.IPSL.IPSL-CM6A-LR.historical.r1i1p1f1.Amon.rlds.gr.v20180803"]
},
"outputs": {
"output": "subset_rlds/output"
},
"steps": {
"subset_rlds": {
"run": "subset",
"in": {
"collection": "inputs/rlds",
}
},
}
}

0 comments on commit 5f435c2

Please sign in to comment.