Skip to content

Commit a186833

Browse files
committed
add a doc on Task features (#195)
* add a doc on Task features * update CHANGELOG.md
1 parent e517b0e commit a186833

File tree

3 files changed

+66
-0
lines changed

3 files changed

+66
-0
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
1717
### ⚠️ Breaking Change
1818

1919
- ([#176]) Removed support for Python 3.9.
20+
- add a doc defining `stactask.Task` features (properties, attributes, and instance methods)
2021

2122
### Added
2223

docs/source/index.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,4 +17,5 @@ Contents
1717
.. toctree::
1818

1919
usage
20+
task
2021
api

docs/source/task.rst

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
stactask.Task — instance reference
2+
=================================
3+
4+
This file lists the most important attributes, properties, and methods
5+
available on a Task instance (what you can access via self) with concise
6+
definitions.
7+
8+
This documentation is provided to make the user aware of stac-task's features. To learn
9+
more see ``src/stactask/task.py``.
10+
11+
.. _instance_attributes:
12+
.. _properties:
13+
.. _instance_methods:
14+
15+
Instance attributes
16+
-------------------
17+
18+
* **payload (Payload)**: The validated Cirrus process payload wrapped in the
19+
Payload helper class. Primary access point for process, workflow, task, upload
20+
options, and features.
21+
* **logger (TaskLoggerAdapter)**: Pre-configured logger that includes task
22+
metadata (task name/version) and can be used for task logging.
23+
* **s3 (boto3utils.s3)**: If present, convenience S3 client utility for
24+
reading/writing S3 objects (used by convenience helpers).
25+
26+
Properties
27+
----------------------------------------------------
28+
29+
Properties can be accessed via ``self.<name>``
30+
31+
* **process_definition (dict)**: Convenience accessor for the first element of
32+
the payload ``process`` list (top-level process configuration for this run).
33+
* **workflow_options (dict)**: Workflow-level options from the process
34+
definition (global parameters for the workflow).
35+
* **task_options (dict)**: Options for this task: the mapping located at
36+
``process.tasks[self.name]`` if present, otherwise an empty dict.
37+
* **parameters (dict)**: Merged parameters, typically ``workflow_options`` merged
38+
with ``task_options`` (task-level overrides workflow-level).
39+
* **upload_options (dict)**: Upload-related options from the process definition
40+
(path templates, headers, collections).
41+
* **collection_matchers (list[dict])**: List of collection-matcher definitions
42+
(JSONPath-based rules used to assign collection names to items).
43+
* **items_as_dicts (list[dict])**: The features list from the payload (each
44+
element is a STAC Item as a plain dict).
45+
* **items (pystac.ItemCollection)**: A pystac.ItemCollection built from the
46+
payload features for convenience when working with pystac Item objects.
47+
48+
Instance methods
49+
----------------
50+
51+
* **assign_collections**: Assign collection names to items in the payload using
52+
``collection_matchers`` mapping.
53+
* **download_item_assets**: Convenience wrapper to download assets for
54+
a single Item. Given a pystac.Item, the Task will download each asset's file to its
55+
local work directory and will update each asset's href.
56+
* **download_items_assets**: Batch variant of ``download_item_assets`` that downloads
57+
assets for multiple items concurrently (uses asyncio under the hood).
58+
* **upload_item_assets_to_s3**: Upload local assets referenced by an Item to S3
59+
(based on path templates) and update asset hrefs to their uploaded
60+
locations. This is an S3-specific helper retained for compatibility.
61+
* **upload_local_item_assets_to_s3**: Helper to find assets whose hrefs point to the
62+
local workdir and upload only those to S3 (based on path templates), updating hrefs.
63+
* **upload_item_to_s3**: Upload a single Item JSON to S3 (based on path templates) as a
64+
JSON file.

0 commit comments

Comments
 (0)