def __init__(self, sockets): logfile = user_data_dir + sep + 'ICARUS.log' log_config(filename=logfile, level=DEBUG, format='%(asctime)s - %(levelname)s: %(message)s') log_info('icarus starting up') self.setpoints = [0.0, 0.0, 2.0] # x, y, z self.flight_time = 0 self.icarus_takeover = False self.emergency_land = False self.factory = ICARUS_MissionFactory self.fsm = FlightSM(self.error, self.broadcast, self.takeoff, self.land, self.move, self.stop) self.landing_spots = LandingSpots(3.0) self.pilot = PilotInterface(sockets['pilot'], sockets['mon']) #self.gps_shifter = GPS_Shifter() self.state_emitter = StateEmitter(sockets['state']) self.powerman = PowerMan(sockets['power_ctrl'], sockets['power_mon']) start_daemon_thread(self.power_state_monitor) start_daemon_thread(self.state_time_monitor) start_daemon_thread(self.pilot_monitor) self.activity = DummyActivity() self.activity.start() self.icarus_srv = ICARUS_Server(sockets['ctrl'], self) self.icarus_srv.start() log_info('icarus up and running')
def __init__(self, name): # set-up logger: logfile = user_data_dir() + sep + 'PowerMan.log' log_config(filename = logfile, level = DEBUG, format = '%(asctime)s - %(levelname)s: %(message)s') # initialized and load config: log_info('powerman starting up') map = generate_map(name) self.ctrl_socket = map['ctrl'] self.monitor_socket = map['mon'] self.opcd = OPCD_Interface(map['opcd_ctrl'], 'powerman') bus = SMBus(self.opcd.get('gpio_i2c_bus')) self.gpio_mosfet = GPIO_Bank(bus, self.opcd.get('gpio_i2c_address')) self.power_pin = self.opcd.get('gpio_power_pin') self.cells = self.opcd.get('battery_cells') self.low_cell_voltage = self.opcd.get('battery_low_cell_voltage') self.capacity = self.opcd.get('battery_capacity') self.low_battery_voltage = self.cells * self.low_cell_voltage self.critical = False self.gpio_mosfet.write() self.warning_started = False # start threads: self.standing = True self.adc_thread = start_daemon_thread(self.adc_reader) self.emitter_thread = start_daemon_thread(self.power_state_emitter) self.request_thread = start_daemon_thread(self.request_handler) log_info('powerman running')
def main(args: Sequence[str]) -> int: """ The main entrypoint. """ log_config(level=DEBUG, format=("%(threadName)s %(asctime)s %(name)s:%(levelname)s " "%(filename)s %(lineno)d: %(message)s")) packages: List[Package] = [] package_root = abspath("./packages") build_root = abspath("./builds") dist_root = abspath("./dist") if not exists(build_root): mkdir(build_root) if not exists(package_root): mkdir(package_root) if not exists(dist_root): mkdir(dist_root) log.debug("build_root: %s", build_root) log.debug("package_root: %s", package_root) with open("packages.yaml", "r") as fd: package_infos = yaml.safe_load(fd) for package_info in package_infos: packages.append(Package.from_yaml_config(package_info)) for platform in Platform: for package in packages: pb = PackageBuild(package=package, platform=platform, build_root=build_root, package_root=package_root, remove_build_dir=False) pb.stage_files() pb.build() pb.export(dest_root=path_join(dist_root, platform.os_name)) return 0
def __init__(self, sockets): logfile = user_data_dir() + sep + "ICARUS.log" log_config(filename=logfile, level=DEBUG, format="%(asctime)s - %(levelname)s: %(message)s") log_info("icarus starting up") self.setpoints = [0.0, 0.0, 2.0] # x, y, z self.flight_time = 0 self.icarus_takeover = False self.emergency_land = False self.factory = ICARUS_MissionFactory self.fsm = flight_sm(self) self.landing_spots = LandingSpots(3.0) self.core = CoreInterface(sockets["core"], sockets["mon"]) # self.gps_shifter = GPS_Shifter() self.state_emitter = StateEmitter(sockets["state"]) self.powerman = PowerMan(sockets["power_ctrl"], sockets["power_mon"]) start_daemon_thread(self.power_state_monitor) start_daemon_thread(self.state_time_monitor) start_daemon_thread(self.core_monitor) self.activity = DummyActivity() self.activity.start() self.icarus_srv = ICARUS_Server(sockets["ctrl"], self) self.icarus_srv.start() log_info("icarus up and running")
def __init__(self, sockets): logfile = user_data_dir + sep + 'ICARUS.log' log_config(filename = logfile, level = DEBUG, format = '%(asctime)s - %(levelname)s: %(message)s') log_info('icarus starting up') self.setpoints = [0.0, 0.0, 1.0] # x, y, z self.flight_time = 0 self.icarus_takeover = False self.emergency_land = False self.factory = ICARUS_MissionFactory self.fsm = FlightSM(self.error, self.broadcast, self.takeoff, self.land, self.move, self.stop) self.landing_spots = LandingSpots(3.0) self.pilot = PilotInterface(sockets['ap_ctrl'], sockets['ap_mon']) #self.gps_shifter = GPS_Shifter() self.state_socket = sockets['icarus_state'] #start_daemon_thread(self.power_state_monitor) start_daemon_thread(self.state_time_monitor) start_daemon_thread(self.pilot_monitor) self.activity = DummyActivity() self.activity.start() self.icarus_srv = ICARUS_Server(sockets['icarus_ctrl'], self) self.icarus_srv.start() log_info('icarus up and running')
from logging import basicConfig as log_config from logging import error as log from os import path from re import search as re_search from re import UNICODE as re_unicode from settings import PARSERENGINE_GO_BIN from settings import PARSERENGINE_IN from settings import PARSERENGINE_OUT from extractor.models import Session from extractor.models.djbr_extracted_data import DJBRExtractedData from hashlib import md5 from sqlalchemy.sql.expression import literal from urllib.parse import urlparse log_config( # filename="log.txt", format='%(levelname)s: %(asctime)s: %(module)s: %(message)s') VALID_URL = ["https://data.controlciudadanopy.org"] class DJBRParser: djbr_cid = 0 djbr_fullname = '' djbr_type = '' djbr_path = '' djbr_version = '' pdf = None stdout = {} filepath = None
from logging import WARNING, ERROR, INFO, DEBUG, basicConfig as log_config, getLogger as get_logger from configparser import ConfigParser import os from signal import signal, SIGINT from docopt import docopt from MMD import __version__, CONFIG_PATH, LOG_PATH from MMD.utils import ColorizeFilter from MMD.Domain import domain, MangaHere from MMD.strings import * # Supported Domains DOMAINS = {'MangaHere': MangaHere.Downloader} # SetUp the logger log_config(level=INFO, format='%(message)s', filename=LOG_PATH) get_logger('requests').setLevel(WARNING) log = get_logger(__name__) log.setLevel(INFO) log.addFilter(ColorizeFilter()) # SetUp the ConfigParser config = ConfigParser() config.read(CONFIG_PATH) # Argument ID's DOMAIN_ID = '--domain' URL_ID = '--url' PATH_ID = '--path' THREADING_ID = '--threading' DEBUG_ID = '--debug'