This PR stops agent data from being loaded into the database by create_db, and replaces all remaining agent-related database calls with queries against the agent_desc instead.
Rationale:
95% of the agent-related database items have already been removed
This is required to make the #253 work properly (a workaround would be adding a new table for the 'weighted' section, which is now a list instead of a string and thus requires a makeover)
With the B2 update (or sooner), the agent_desc values will no longer be fixed; for example, the user will be able to modify the CO2-scrubber activation level (1000 ppm by default). Therefore, the agent_desc should be treated as a 'live' variable instead of something fixed and stored in the database.
The changes made in this PR are:
Comment-out the call to seed_agents.seed() in create_db.py. The tables are still created (you can check via adminer), but they're no longer populated. Those table definitions should be removed along with other unused code in a future 'housekeeping' PR.
Relocate the load_from_basedir function from views.py to front_end_routes.py; I want to use it in both files to read-in the agent_desc.json, and before relocating it I was getting a circular import error. Pretty basic.
Replace database calls with reading the agent_desc in 3 functions: convert_configuration, get_energy, and get_agent_types_by_class. These were the only 3 remaining references to the agents DB currently touched by the frontend.
This PR is ready to be reviewed, tested and merged, and is a prerequisite for #253.
This PR stops agent data from being loaded into the database by
create_db
, and replaces all remaining agent-related database calls with queries against theagent_desc
instead.Rationale:
agent_desc
values will no longer be fixed; for example, the user will be able to modify the CO2-scrubber activation level (1000 ppm by default). Therefore, theagent_desc
should be treated as a 'live' variable instead of something fixed and stored in the database.The changes made in this PR are:
seed_agents.seed()
increate_db.py
. The tables are still created (you can check via adminer), but they're no longer populated. Those table definitions should be removed along with other unused code in a future 'housekeeping' PR.load_from_basedir
function fromviews.py
tofront_end_routes.py
; I want to use it in both files to read-in theagent_desc.json
, and before relocating it I was getting a circular import error. Pretty basic.agent_desc
in 3 functions:convert_configuration
,get_energy
, andget_agent_types_by_class
. These were the only 3 remaining references to the agents DB currently touched by the frontend.This PR is ready to be reviewed, tested and merged, and is a prerequisite for #253.