def __init__(self, config, exchange_interface, notifier): """Initializes DefaultBehaviour class. Args: indicator_conf (dict): A dictionary of configuration for this analyzer. exchange_interface (ExchangeInterface): Instance of the ExchangeInterface class for making exchange queries. notifier (Notifier): Instance of the notifier class for informing a user when a threshold has been crossed. """ self.logger = structlog.get_logger() self.indicator_conf = config.indicators self.informant_conf = config.informants self.crossover_conf = config.crossovers self.exchange_interface = exchange_interface self.strategy_analyzer = StrategyAnalyzer() self.notifier = notifier self.all_historical_data = dict() output_interface = Output() self.output = output_interface.dispatcher self.enable_charts = config.settings['enable_charts'] self.timezone = config.settings['timezone']
def __init__(self, scenario_id, api_run=False): self.scenario_id = scenario_id self.scenario = Scenario(self.scenario_id) self.api_run = api_run self.outputs = Output() self.demand = Demand(self.scenario) self.supply = None self.demand_solved, self.supply_solved = False, False
def __init__(self, scenario_id, api_run=False): self.scenario_id = scenario_id self.api_run = api_run self.scenario = cfg.scenario_dict[self.scenario_id] self.demand_case_id = util.sql_read_table('Scenarios', 'demand_case', id=self.scenario_id) self.supply_case_id = util.sql_read_table('Scenarios', 'supply_case', id=self.scenario_id) self.outputs = Output() self.demand = Demand() self.supply = None self.demand_solved, self.supply_solved = False, False
def __modular_processing(self,module): prefix = "ramas_" #create a temporary file in /tmp for this module temp_tuple = tempfile.mkstemp(suffix=".dump", prefix=prefix) temp_handler = open(temp_tuple[1], "w+") # open the file self.__process(module, temp_handler) # preprocess the file temp_handler.seek(0) # go back to the beginning of the file # parse the file (extract information) records = self.__get_module_records(temp_handler, module) temp_handler.close() # close the file #output operations output_gen = Output() output_gen.setup(self.fileHash, module, self.modules) recordFields = readRecordFields("platforms/" + module + ".cfg") self.__insertMessage(records, recordFields, module) output_gen.out(records, recordFields)
def __init__(self, cfgfile_path, custom_pint_definitions_path=None, name=None, author=None): self.cfgfile_path = cfgfile_path self.custom_pint_definitions_path = custom_pint_definitions_path self.model_config(cfgfile_path, custom_pint_definitions_path) self.name = cfg.cfgfile.get('case', 'scenario') if name is None else name self.author = cfg.cfgfile.get('case', 'author') if author is None else author self.scenario_dict = dict( zip( util.sql_read_table('Scenarios', 'id', return_iterable=True, is_active=True), util.sql_read_table('Scenarios', 'name', return_iterable=True, is_active=True))) self.outputs = Output() self.geography = cfg.cfgfile.get('case', 'primary_geography')
# Read config/params from JSON file config = read_config() ###################### # Main Learning code: ###################### # Create Environment instance env = MPIMapEnv(params=config) # Create Agent instance agent = Agent(env=env, params=config) # Output data output = Output(agent=agent, env=env, params=config) start = time.time() n_episodes = config["Hyperparameters"]["n_episodes"] for episode in range(n_episodes): terminal = False s = env.reset() agent.reset() while not terminal:
def __init__(self, config_file=configuration_file, logname=logname, logging_config_file=local_syslog_config_file): """ Will initialize the sensor, reading the configuration file and creating the sensorinfo attributes """ # FIRST always init the logger, as it's used by rest of methods self.logger = self.localsysloginitialization(logname, logging_config_file) # All information related with the wlan part of the sensor # using the external Class Wireless(), that encapsulates the wlan # needs for the sensor self.wlan = Wireless(self.logname) # All information related with the TESTs is managed with the external # class Test(), encapsulating all information and methods needed for # the tests to run self.test = Test(self.logname) # Read the sensor configuration self.sensor = self.readconfigfile(config_file) # Initialize the Main variable to use, a LIST with all the WLAN # networks to test, with their connection information. Each WLAN OBJECT # has two LISTS inside: TESTS, is the list of tests to run (bandwidth, # delay, packet loss, dns test, etc.) and OUTPUTS, the list of output # methods to use to send the information # self.sensor = { # "sensorinfo":{general information about sensor}} # "wlans":[ # { # "wlanid":1 # "configuration":{ssid, ip, etc.} # "tests":[ # {test1}, # {test2}, # ..., # {testN} # ], # "outputs":[ # {output1}, # {output2}, # ..., # {outputN} # ], # "results":[ # {result_test1}, # {result_test2}, # ..., # {result_testN} # ] # }, # { # "wlanid":2 # "configuration":{ssid, ip, etc.} # "tests":[ # {test1}, # {test2}, # ..., # {testN} # ], # "outputs":[ # {output1}, # {output2}, # ..., # {outputN} # ], # "results":[ # {result_test1}, # {result_test2}, # ..., # {result_testN} # ] # }, # { # "wlanid":3 # "configuration":{ssid, ip, etc.} # "tests":[ # {test1}, # {test2}, # ..., # {testN} # ], # "outputs":[ # {output1}, # {output2}, # ..., # {outputN} # ], # "results":[ # {result_test1}, # {result_test2}, # ..., # {result_testN} # ] # }, # ] # } # Init the output part of the sensor self.output = Output(self)