Skip to content

Commit 811a193

Browse files
authored
Revert changes to downloads api (#600)
* Revert go changes
1 parent be8aff8 commit 811a193

File tree

2 files changed

+10
-4
lines changed

2 files changed

+10
-4
lines changed

api/models/download.go

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,6 @@ type PackagerRequest struct {
6868
Contents []PackagerContentItem `json:"contents"`
6969
Format string `json:"format"`
7070
Extent Extent `json:"extent"`
71-
ProductIDs []uuid.UUID `json:"product_ids"`
7271
}
7372

7473
// Extent is a name and a bounding box
@@ -211,8 +210,7 @@ func GetDownloadPackagerRequest(db *pgxpool.Pool, downloadID *uuid.UUID) (*Packa
211210
'/download_', d.id, '.', f.extension
212211
) AS output_key,
213212
f.abbreviation AS format,
214-
COALESCE(c.contents, '[]'::jsonb) AS contents,
215-
ARRAY(SELECT product_id FROM download_product WHERE download_id = $1) AS product_ids
213+
COALESCE(c.contents, '[]'::jsonb) AS contents
216214
FROM download d
217215
INNER JOIN download_format f ON f.id = d.download_format_id
218216
LEFT JOIN watershed w ON w.id = d.watershed_id

async_packager/packager.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,14 @@ def handle_message(message):
5757
if resp.status_code != 200:
5858
raise Exception(resp)
5959

60+
# get the full download record to retrieve the requested product_id list
61+
dl_resp = requests.request(
62+
"GET",
63+
url=f"{CUMULUS_API_URL}/downloads/{download_id}",
64+
params={"key": APPLICATION_KEY},
65+
)
66+
requested_product_ids = dl_resp.json().get("product_id", []) if dl_resp.status_code == 200 else []
67+
6068
# create a temporary directory and release in final exception
6169
dst = TemporaryDirectory()
6270
logger.debug(f"Temporary Directory: {dst.name}")
@@ -78,7 +86,7 @@ def handle_message(message):
7886
product_stats = writer_result["product_stats"]
7987

8088
# Fill in products that had 0 files in contents
81-
for pid in PayloadResp.product_ids:
89+
for pid in requested_product_ids:
8290
if str(pid) not in product_stats:
8391
product_stats[str(pid)] = {"expected": 0, "successful": 0}
8492

0 commit comments

Comments
 (0)