Skip to content

Commit

Permalink
Move a bunch of stuff to system/ part 3 (#24829)
Browse files Browse the repository at this point in the history
* move swaglog.py

* timezoned

* logmessaged

* version.py

* fix linter
  • Loading branch information
adeebshihadeh committed Jun 12, 2022
1 parent fbd98b0 commit 0fce5d9
Show file tree
Hide file tree
Showing 56 changed files with 76 additions and 73 deletions.
2 changes: 1 addition & 1 deletion .pylintrc
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
# A comma-separated list of package or module names from where C extensions may
# be loaded. Extensions are loading into the active Python interpreter and may
# run arbitrary code
extension-pkg-whitelist=scipy,cereal.messaging.messaging_pyx,PyQt5
extension-pkg-whitelist=scipy,cereal.messaging.messaging_pyx,PyQt5,av

# Add files or directories to the blacklist. They should be base names, not
# paths.
Expand Down
2 changes: 1 addition & 1 deletion common/api/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import requests
from datetime import datetime, timedelta
from common.basedir import PERSIST
from selfdrive.version import get_version
from system.version import get_version

API_HOST = os.getenv('API_HOST', 'https://api.commadotai.com')

Expand Down
6 changes: 4 additions & 2 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,12 @@
# documentation root, use os.path.abspath to make it absolute, like shown here.
#
import os
from os.path import exists
import sys
from selfdrive.version import get_version
from os.path import exists

from common.basedir import BASEDIR
from system.version import get_version

sys.path.insert(0, os.path.abspath('.'))
sys.path.insert(0, os.path.abspath('..'))

Expand Down
8 changes: 4 additions & 4 deletions release/files_common
Original file line number Diff line number Diff line change
Expand Up @@ -61,17 +61,17 @@ release/*
tools/lib/*
tools/joystick/*

selfdrive/version.py

selfdrive/__init__.py
selfdrive/sentry.py
selfdrive/swaglog.py
selfdrive/logmessaged.py
selfdrive/tombstoned.py
selfdrive/updated.py
selfdrive/rtshield.py
selfdrive/statsd.py

system/logmessaged.py
system/swaglog.py
system/version.py

selfdrive/athena/__init__.py
selfdrive/athena/athenad.py
selfdrive/athena/manage_athenad.py
Expand Down
2 changes: 1 addition & 1 deletion release/files_tici
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ third_party/snpe/larch64**
third_party/snpe/aarch64-ubuntu-gcc7.5/*
third_party/mapbox-gl-native-qt/include/*

selfdrive/timezoned.py
system/timezoned.py

selfdrive/assets/navigation/*
selfdrive/assets/training_wide/*
Expand Down
4 changes: 2 additions & 2 deletions selfdrive/athena/athenad.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@
from selfdrive.loggerd.config import ROOT
from selfdrive.loggerd.xattr_cache import getxattr, setxattr
from selfdrive.statsd import STATS_DIR
from selfdrive.swaglog import SWAGLOG_DIR, cloudlog
from selfdrive.version import get_commit, get_origin, get_short_branch, get_version
from system.swaglog import SWAGLOG_DIR, cloudlog
from system.version import get_commit, get_origin, get_short_branch, get_version

ATHENA_HOST = os.getenv('ATHENA_HOST', 'wss://athena.comma.ai')
HANDLER_THREADS = int(os.getenv('HANDLER_THREADS', "4"))
Expand Down
4 changes: 2 additions & 2 deletions selfdrive/athena/manage_athenad.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@

from common.params import Params
from selfdrive.manager.process import launcher
from selfdrive.swaglog import cloudlog
from selfdrive.version import get_version, is_dirty
from system.swaglog import cloudlog
from system.version import get_version, is_dirty

ATHENA_MGR_PID_PARAM = "AthenadPid"

Expand Down
2 changes: 1 addition & 1 deletion selfdrive/athena/registration.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
from common.basedir import PERSIST
from selfdrive.controls.lib.alertmanager import set_offroad_alert
from system.hardware import HARDWARE, PC
from selfdrive.swaglog import cloudlog
from system.swaglog import cloudlog


UNREGISTERED_DONGLE_ID = "UnregisteredDevice"
Expand Down
2 changes: 1 addition & 1 deletion selfdrive/athena/tests/test_athenad.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
from websocket import ABNF
from websocket._exceptions import WebSocketConnectionClosedException

from selfdrive import swaglog
from system import swaglog
from selfdrive.athena import athenad
from selfdrive.athena.athenad import MAX_RETRY_COUNT, dispatcher
from selfdrive.athena.tests.helpers import MockWebsocket, MockParams, MockApi, EchoSocket, with_http_server
Expand Down
2 changes: 1 addition & 1 deletion selfdrive/boardd/pandad.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
from common.basedir import BASEDIR
from common.params import Params
from system.hardware import HARDWARE
from selfdrive.swaglog import cloudlog
from system.swaglog import cloudlog


def get_expected_signature(panda: Panda) -> bytes:
Expand Down
2 changes: 1 addition & 1 deletion selfdrive/boardd/tests/boardd_old.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

import cereal.messaging as messaging
from common.realtime import Ratekeeper
from selfdrive.swaglog import cloudlog
from system.swaglog import cloudlog
from selfdrive.boardd.boardd import can_capnp_to_can_list
from cereal import car

Expand Down
4 changes: 2 additions & 2 deletions selfdrive/car/car_helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@
from cereal import car
from common.params import Params
from common.basedir import BASEDIR
from selfdrive.version import is_comma_remote, is_tested_branch
from system.version import is_comma_remote, is_tested_branch
from selfdrive.car.interfaces import get_interface_attr
from selfdrive.car.fingerprints import eliminate_incompatible_cars, all_legacy_fingerprint_cars
from selfdrive.car.vin import get_vin, VIN_UNKNOWN
from selfdrive.car.fw_versions import get_fw_versions, match_fw_to_car
from selfdrive.swaglog import cloudlog
from system.swaglog import cloudlog
import cereal.messaging as messaging
from selfdrive.car import gen_empty_fingerprint

Expand Down
2 changes: 1 addition & 1 deletion selfdrive/car/disable_ecu.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
from selfdrive.car.isotp_parallel_query import IsoTpParallelQuery
from selfdrive.swaglog import cloudlog
from system.swaglog import cloudlog

EXT_DIAG_REQUEST = b'\x10\x03'
EXT_DIAG_RESPONSE = b'\x50\x03'
Expand Down
2 changes: 1 addition & 1 deletion selfdrive/car/fw_versions.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
from selfdrive.car.fingerprints import FW_VERSIONS
from selfdrive.car.isotp_parallel_query import IsoTpParallelQuery
from selfdrive.car.toyota.values import CAR as TOYOTA
from selfdrive.swaglog import cloudlog
from system.swaglog import cloudlog

Ecu = car.CarParams.Ecu

Expand Down
2 changes: 1 addition & 1 deletion selfdrive/car/isotp_parallel_query.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
from typing import Optional

import cereal.messaging as messaging
from selfdrive.swaglog import cloudlog
from system.swaglog import cloudlog
from selfdrive.boardd.boardd import can_list_to_can_capnp
from panda.python.uds import CanClient, IsoTpMessage, FUNCTIONAL_ADDRS, get_rx_addr_for_tx_addr

Expand Down
2 changes: 1 addition & 1 deletion selfdrive/car/mock/interface.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import math
from cereal import car
from common.conversions import Conversions as CV
from selfdrive.swaglog import cloudlog
from system.swaglog import cloudlog
import cereal.messaging as messaging
from selfdrive.car import gen_empty_fingerprint, get_safety_config
from selfdrive.car.interfaces import CarInterfaceBase
Expand Down
2 changes: 1 addition & 1 deletion selfdrive/car/vin.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
import panda.python.uds as uds
from panda.python.uds import FUNCTIONAL_ADDRS
from selfdrive.car.isotp_parallel_query import IsoTpParallelQuery
from selfdrive.swaglog import cloudlog
from system.swaglog import cloudlog

OBD_VIN_REQUEST = b'\x09\x02'
OBD_VIN_RESPONSE = b'\x49\x02\x01'
Expand Down
2 changes: 1 addition & 1 deletion selfdrive/controls/controlsd.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
import cereal.messaging as messaging
from common.conversions import Conversions as CV
from panda import ALTERNATIVE_EXPERIENCE
from selfdrive.swaglog import cloudlog
from system.swaglog import cloudlog
from selfdrive.boardd.boardd import can_list_to_can_capnp
from selfdrive.car.car_helpers import get_car, get_startup_event, get_one_can
from selfdrive.controls.lib.lane_planner import CAMERA_OFFSET
Expand Down
2 changes: 1 addition & 1 deletion selfdrive/controls/lib/events.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
from common.conversions import Conversions as CV
from common.realtime import DT_CTRL
from selfdrive.locationd.calibrationd import MIN_SPEED_FILTER
from selfdrive.version import get_short_branch
from system.version import get_short_branch

AlertSize = log.ControlsState.AlertSize
AlertStatus = log.ControlsState.AlertStatus
Expand Down
2 changes: 1 addition & 1 deletion selfdrive/controls/lib/lane_planner.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
from common.filter_simple import FirstOrderFilter
from common.numpy_fast import interp
from common.realtime import DT_MDL
from selfdrive.swaglog import cloudlog
from system.swaglog import cloudlog


TRAJECTORY_SIZE = 33
Expand Down
2 changes: 1 addition & 1 deletion selfdrive/controls/lib/lateral_planner.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import numpy as np
from common.realtime import sec_since_boot, DT_MDL
from common.numpy_fast import interp
from selfdrive.swaglog import cloudlog
from system.swaglog import cloudlog
from selfdrive.controls.lib.lateral_mpc_lib.lat_mpc import LateralMpc
from selfdrive.controls.lib.drive_helpers import CONTROL_N, MPC_COST_LAT, LAT_MPC_N, CAR_ROTATION_RADIUS
from selfdrive.controls.lib.lane_planner import LanePlanner, TRAJECTORY_SIZE
Expand Down
2 changes: 1 addition & 1 deletion selfdrive/controls/lib/longitudinal_mpc_lib/long_mpc.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

from common.realtime import sec_since_boot
from common.numpy_fast import clip, interp
from selfdrive.swaglog import cloudlog
from system.swaglog import cloudlog
from selfdrive.modeld.constants import index_function
from selfdrive.controls.lib.radar_helpers import _LEAD_ACCEL_TAU

Expand Down
2 changes: 1 addition & 1 deletion selfdrive/controls/lib/longitudinal_planner.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
from selfdrive.controls.lib.longitudinal_mpc_lib.long_mpc import LongitudinalMpc
from selfdrive.controls.lib.longitudinal_mpc_lib.long_mpc import T_IDXS as T_IDXS_MPC
from selfdrive.controls.lib.drive_helpers import V_CRUISE_MAX, CONTROL_N
from selfdrive.swaglog import cloudlog
from system.swaglog import cloudlog

LON_MPC_STEP = 0.2 # first step is 0.2s
AWARENESS_DECEL = -0.2 # car smoothly decel at .2m/s^2 when user is distracted
Expand Down
2 changes: 1 addition & 1 deletion selfdrive/controls/plannerd.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
from cereal import car
from common.params import Params
from common.realtime import Priority, config_realtime_process
from selfdrive.swaglog import cloudlog
from system.swaglog import cloudlog
from selfdrive.controls.lib.longitudinal_planner import Planner
from selfdrive.controls.lib.lateral_planner import LateralPlanner
import cereal.messaging as messaging
Expand Down
2 changes: 1 addition & 1 deletion selfdrive/controls/radard.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
from common.realtime import Ratekeeper, Priority, config_realtime_process
from selfdrive.controls.lib.cluster.fastcluster_py import cluster_points_centroid
from selfdrive.controls.lib.radar_helpers import Cluster, Track, RADAR_TO_CAMERA
from selfdrive.swaglog import cloudlog
from system.swaglog import cloudlog


class KalmanParams():
Expand Down
2 changes: 1 addition & 1 deletion selfdrive/debug/disable_ecu.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

import cereal.messaging as messaging
from selfdrive.car.isotp_parallel_query import IsoTpParallelQuery
from selfdrive.swaglog import cloudlog
from system.swaglog import cloudlog

EXT_DIAG_REQUEST = b'\x10\x03'
EXT_DIAG_RESPONSE = b'\x50\x03'
Expand Down
2 changes: 1 addition & 1 deletion selfdrive/locationd/calibrationd.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
from common.transformations.model import model_height
from common.transformations.camera import get_view_frame_from_road_frame
from common.transformations.orientation import rot_from_euler, euler_from_rot
from selfdrive.swaglog import cloudlog
from system.swaglog import cloudlog

MIN_SPEED_FILTER = 15 * CV.MPH_TO_MS
MAX_VEL_ANGLE_STD = np.radians(0.25)
Expand Down
2 changes: 1 addition & 1 deletion selfdrive/locationd/laikad.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
from selfdrive.locationd.models.gnss_kf import GNSSKalman
from selfdrive.locationd.models.gnss_kf import States as GStates
import common.transformations.coordinates as coord
from selfdrive.swaglog import cloudlog
from system.swaglog import cloudlog

MAX_TIME_GAP = 10

Expand Down
2 changes: 1 addition & 1 deletion selfdrive/locationd/models/car_kf.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

from selfdrive.controls.lib.vehicle_model import ACCELERATION_DUE_TO_GRAVITY
from selfdrive.locationd.models.constants import ObservationKind
from selfdrive.swaglog import cloudlog
from system.swaglog import cloudlog

from rednose.helpers.kalmanfilter import KalmanFilter

Expand Down
2 changes: 1 addition & 1 deletion selfdrive/locationd/paramsd.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
from common.numpy_fast import clip
from selfdrive.locationd.models.car_kf import CarKalman, ObservationKind, States
from selfdrive.locationd.models.constants import GENERATED_DIR
from selfdrive.swaglog import cloudlog
from system.swaglog import cloudlog


MAX_ANGLE_OFFSET_DELTA = 20 * DT_MDL # Max 20 deg/s
Expand Down
2 changes: 1 addition & 1 deletion selfdrive/loggerd/deleter.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import os
import shutil
import threading
from selfdrive.swaglog import cloudlog
from system.swaglog import cloudlog
from selfdrive.loggerd.config import ROOT, get_available_bytes, get_available_percent
from selfdrive.loggerd.uploader import listdir_by_creation

Expand Down
2 changes: 1 addition & 1 deletion selfdrive/loggerd/tests/test_loggerd.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
from common.timeout import Timeout
from selfdrive.loggerd.config import ROOT
from selfdrive.manager.process_config import managed_processes
from selfdrive.version import get_version
from system.version import get_version
from tools.lib.logreader import LogReader
from cereal.visionipc import VisionIpcServer, VisionStreamType
from common.transformations.camera import tici_f_frame_size, tici_d_frame_size, tici_e_frame_size
Expand Down
2 changes: 1 addition & 1 deletion selfdrive/loggerd/tests/test_uploader.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
import logging
import json

from selfdrive.swaglog import cloudlog
from system.swaglog import cloudlog
import selfdrive.loggerd.uploader as uploader

from selfdrive.loggerd.tests.loggerd_tests_common import UploaderTestCase
Expand Down
2 changes: 1 addition & 1 deletion selfdrive/loggerd/uploader.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
from system.hardware import TICI
from selfdrive.loggerd.xattr_cache import getxattr, setxattr
from selfdrive.loggerd.config import ROOT
from selfdrive.swaglog import cloudlog
from system.swaglog import cloudlog

NetworkType = log.DeviceState.NetworkType
UPLOAD_ATTR_NAME = 'user.upload'
Expand Down
4 changes: 2 additions & 2 deletions selfdrive/manager/build.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@
from common.spinner import Spinner
from common.text_window import TextWindow
from system.hardware import AGNOS
from selfdrive.swaglog import cloudlog, add_file_handler
from selfdrive.version import is_dirty
from system.swaglog import cloudlog, add_file_handler
from system.version import is_dirty

MAX_CACHE_SIZE = 4e9 if "CI" in os.environ else 2e9
CACHE_DIR = Path("/data/scons_cache" if AGNOS else "/tmp/scons_cache")
Expand Down
4 changes: 2 additions & 2 deletions selfdrive/manager/manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@
from selfdrive.manager.process import ensure_running
from selfdrive.manager.process_config import managed_processes
from selfdrive.athena.registration import register, UNREGISTERED_DONGLE_ID
from selfdrive.swaglog import cloudlog, add_file_handler
from selfdrive.version import is_dirty, get_commit, get_version, get_origin, get_short_branch, \
from system.swaglog import cloudlog, add_file_handler
from system.version import is_dirty, get_commit, get_version, get_origin, get_short_branch, \
terms_version, training_version


Expand Down
2 changes: 1 addition & 1 deletion selfdrive/manager/process.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
from common.basedir import BASEDIR
from common.params import Params
from common.realtime import sec_since_boot
from selfdrive.swaglog import cloudlog
from system.swaglog import cloudlog
from system.hardware import HARDWARE
from cereal import log

Expand Down
Loading

0 comments on commit 0fce5d9

Please sign in to comment.