Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 18 additions & 13 deletions stactask/task.py
Original file line number Diff line number Diff line change
Expand Up @@ -461,6 +461,22 @@ def _post_process_item(self, item: dict[str, Any]) -> dict[str, Any]:
item["stac_extensions"].sort()
return item

@classmethod
def configure_logging(cls, loglevel: str) -> None:
"""Configures logging."""
logging.basicConfig(level=loglevel)

# quiet these loud loggers
for ql in [
"botocore",
"s3transfer",
"urllib3",
"fsspec",
"asyncio",
"aiobotocore",
]:
logging.getLogger(ql).propagate = False

@classmethod
def handler(cls, payload: dict[str, Any], **kwargs: Any) -> dict[str, Any]:
task = None
Expand Down Expand Up @@ -612,7 +628,7 @@ def parse_args(cls, args: list[str]) -> dict[str, Any]:
if pargs.get("output") is None:
pargs["output"] = Path(pargs["workdir"]) / "output-payload.json"

if pargs.get("command", None) is None:
if pargs.get("command") is None:
parser.print_help()
sys.exit(0)

Expand All @@ -625,18 +641,7 @@ def cli(cls) -> None:

# logging
loglevel = args.pop("logging")
logging.basicConfig(level=loglevel)

# quiet these loud loggers
for ql in [
"botocore",
"s3transfer",
"urllib3",
"fsspec",
"asyncio",
"aiobotocore",
]:
logging.getLogger(ql).propagate = False
cls.configure_logging(loglevel)

if cmd == "run":
href = args.pop("input", None)
Expand Down