Skip to content

Introduce job result downloading with item walking and ref rewriting - #933

Open
soxofaan wants to merge 5 commits into
masterfrom
issue931-deep-job-result-download
Open

Introduce job result downloading with item walking and ref rewriting#933
soxofaan wants to merge 5 commits into
masterfrom
issue931-deep-job-result-download

Conversation

@soxofaan

Copy link
Copy Markdown
Member

ref #931

Comment thread openeo/rest/job.py Outdated
Comment thread openeo/rest/job.py
target: Union[Path, str] = None,
*,
rewrite_references: bool = True,
) -> List[Path]:

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

expose other args:

  • extra_link_rels_to_download
  • download_collection_assets
  • json style options

Comment thread openeo/rest/job.py
"""

# TODO: make this a public API that users can implement for custom download behavior (e.g. download to S3, ...)
# TODO: API to warn about or skip existing/previously downloaded files?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TODO: API to skip download failures (after retries) and just warn?

Comment thread openeo/rest/job.py Outdated

result_metadata_path = self._root_path / DEFAULT_JOB_RESULTS_FILENAME
# Initial write of metadata, will possibly be updated later if rewrite_references is True
self._json_dump(data=result_metadata, path=result_metadata_path)

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

give initial file a ".inprogress" suffix?
and only swap to final filename at the end

Comment thread openeo/rest/job.py Outdated
self._connection = job.connection
self._root_path = Path(target or Path.cwd() / job.job_id)
self._rewrite_references = rewrite_references
self._downloaded = []

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use this list of downloaded files to avoid overwrites

Comment thread openeo/rest/job.py Outdated
Comment thread tests/rest/test_job.py
requests_mock.get(item_href, json=item_doc)
return item_href

def setup(*, job_id="job-123", items: dict, api_url: str = API_URL):

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

make this a class instead of closured functions

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant