Skip to content

Commit

Permalink
Merge pull request #240 from ASFHyP3/re-enable-insar
Browse files Browse the repository at this point in the history
Re enable insar
  • Loading branch information
Jlrine2 authored Sep 3, 2020
2 parents 290a008 + 96f47aa commit b212fee
Show file tree
Hide file tree
Showing 3 changed files with 48 additions and 9 deletions.
13 changes: 6 additions & 7 deletions api/src/hyp3_api/openapi-spec.yml
Original file line number Diff line number Diff line change
Expand Up @@ -212,8 +212,7 @@ components:
example: RTC_GAMMA
enum:
- RTC_GAMMA
# Holding INSAR GAMMA support until Vertex integration is ready
# - INSAR_GAMMA
- INSAR_GAMMA

job_parameters:
oneOf:
Expand All @@ -228,7 +227,7 @@ components:
additionalProperties: false
properties:
granules:
$ref: '#/components/schemas/insar_gamma_granules'
$ref: "#/components/schemas/insar_gamma_granules"
include_inc_map:
$ref: "#/components/schemas/include_inc_map"
looks:
Expand All @@ -245,7 +244,7 @@ components:
additionalProperties: false
properties:
granules:
$ref: '#/components/schemas/rtc_gamma_granules'
$ref: "#/components/schemas/rtc_gamma_granules"
resolution:
$ref: "#/components/schemas/resolution"
radiometry:
Expand All @@ -266,16 +265,16 @@ components:
minItems: 2
maxItems: 2
items:
$ref: '#/components/schemas/granule_slc'
$ref: "#/components/schemas/granule_slc"

rtc_gamma_granules:
type: array
minItems: 1
maxItems: 1
items:
anyOf:
- $ref: '#/components/schemas/granule_grdh'
- $ref: '#/components/schemas/granule_slc'
- $ref: "#/components/schemas/granule_grdh"
- $ref: "#/components/schemas/granule_slc"


granule_grdh:
Expand Down
5 changes: 3 additions & 2 deletions api/tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,12 +48,13 @@ def get_table_properties_from_template():

def make_job(granules=['S1B_IW_SLC__1SDV_20200604T082207_20200604T082234_021881_029874_5E38'],
name='someName',
job_type='RTC_GAMMA'):
job_type='RTC_GAMMA',
parameters={},):
job = {
'job_type': job_type,
'job_parameters': {
'granules': granules,
'resolution': 30.0,
**parameters
}
}
if name is not None:
Expand Down
39 changes: 39 additions & 0 deletions api/tests/test_submit_job.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,32 @@ def test_submit_one_job(client, table):
assert jobs[0]['user_id'] == DEFAULT_USERNAME


def test_submit_insar_gamma(client, table):
login(client)
job = make_job(
[
'S1A_IW_SLC__1SDV_20200720T172109_20200720T172128_033541_03E2FB_341F',
'S1A_IW_SLC__1SDV_20200813T172110_20200813T172129_033891_03EE3F_2C3E'
],
job_type='INSAR_GAMMA'
)
response = submit_batch(client, batch=[job])
assert response.status_code == status.HTTP_200_OK


def test_submit_multiple_job_types(client, table):
login(client)
job = make_job(
[
'S1A_IW_SLC__1SDV_20200720T172109_20200720T172128_033541_03E2FB_341F',
'S1A_IW_SLC__1SDV_20200813T172110_20200813T172129_033891_03EE3F_2C3E'
],
job_type='INSAR_GAMMA'
)
response = submit_batch(client, batch=[job, make_job()])
assert response.status_code == status.HTTP_200_OK


def test_submit_many_jobs(client, table):
max_jobs = 25
login(client)
Expand Down Expand Up @@ -155,6 +181,19 @@ def test_submit_bad_granule_names(client):
assert response.status_code == status.HTTP_400_BAD_REQUEST


def test_float_input(client, table):
login(client)
job = make_job(parameters={'resolution': 30.0})
response = submit_batch(client, batch=[job])
assert response.status_code == status.HTTP_200_OK
assert isinstance(response.json['jobs'][0]['job_parameters']['resolution'], float)

job = make_job(parameters={'resolution': 30})
response = submit_batch(client, batch=[job])
assert response.status_code == status.HTTP_200_OK
assert isinstance(response.json['jobs'][0]['job_parameters']['resolution'], int)


def test_submit_validate_only(client, table):
login(client)

Expand Down

0 comments on commit b212fee

Please sign in to comment.