Skip to content

Commit

Permalink
Improve type checking of the daemon code
Browse files Browse the repository at this point in the history
- add `boto3-stubs[logs]` for type checking of daemon code
- remove (now unnecessary) mypy config
- use `__future__` annotations style for some module-level annotations
  • Loading branch information
sirosen committed Aug 28, 2024
1 parent 6b6fbec commit f9e2618
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 7 deletions.
9 changes: 4 additions & 5 deletions daemon/globus_cw_daemon/daemon.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
"""
Upload messages to cloud watch logs
"""
from __future__ import annotations

import errno
import json
import logging
Expand All @@ -10,7 +12,6 @@
import sys
import threading
import time
import typing as t

import globus_cw_daemon.config as config
import globus_cw_daemon.cwlogs as cwlogs
Expand All @@ -32,14 +33,12 @@

# Data shared with flush thread
_g_lock = threading.Lock()
_g_queue: t.List[cwlogs.Event] = [] # List of Events
_g_queue: list[cwlogs.Event] = [] # List of Events
_g_nr_dropped = 0

# get constant instance_id on start
try:
INSTANCE_ID: t.Union[str, None] = os.readlink("/var/lib/cloud/instance").split("/")[
-1
]
INSTANCE_ID: str | None = os.readlink("/var/lib/cloud/instance").split("/")[-1]
except OSError:
INSTANCE_ID = None

Expand Down
2 changes: 0 additions & 2 deletions daemon/mypy.ini

This file was deleted.

1 change: 1 addition & 0 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ deps =
mypy
client: ./client
daemon: ./daemon
daemon: boto3-stubs[logs]
commands =
client: mypy globus_cw_client {posargs}
daemon: mypy globus_cw_daemon {posargs}
Expand Down

0 comments on commit f9e2618

Please sign in to comment.