mirror of
https://framagit.org/framasoft/framaspace/argos.git
synced 2025-04-28 09:52:38 +02:00
🐛 — Fix --config option for some commands
This commit is contained in:
parent
823a62fa57
commit
416728e546
2 changed files with 11 additions and 6 deletions
|
@ -2,6 +2,8 @@
|
|||
|
||||
## [Unreleased]
|
||||
|
||||
- 🐛 — Fix --config option for some commands
|
||||
|
||||
## 0.1.0
|
||||
|
||||
Date: 2024-04-25
|
||||
|
|
|
@ -149,11 +149,12 @@ async def cleandb(max_results, max_lock_seconds, config):
|
|||
- Removes old results from the database.
|
||||
- Removes locks from tasks that have been locked for too long.
|
||||
"""
|
||||
# It’s mandatory to do it before the imports
|
||||
os.environ["ARGOS_YAML_FILE"] = config
|
||||
|
||||
# The imports are made here otherwise the agent will need server configuration files.
|
||||
from argos.server import queries
|
||||
|
||||
os.environ["ARGOS_YAML_FILE"] = config
|
||||
|
||||
db = await get_db()
|
||||
removed = await queries.remove_old_results(db, max_results)
|
||||
updated = await queries.release_old_locks(db, max_lock_seconds)
|
||||
|
@ -173,13 +174,14 @@ async def cleandb(max_results, max_lock_seconds, config):
|
|||
@coroutine
|
||||
async def reload_config(config):
|
||||
"""Read tasks’ configuration and add/delete tasks in database if needed"""
|
||||
# It’s mandatory to do it before the imports
|
||||
os.environ["ARGOS_YAML_FILE"] = config
|
||||
|
||||
# The imports are made here otherwise the agent will need server configuration files.
|
||||
from argos.server import queries
|
||||
from argos.server.main import get_application, read_config
|
||||
from argos.server.settings import get_app_settings
|
||||
|
||||
os.environ["ARGOS_YAML_FILE"] = config
|
||||
|
||||
appli = get_application()
|
||||
settings = get_app_settings()
|
||||
config = read_config(appli, settings)
|
||||
|
@ -202,11 +204,12 @@ async def reload_config(config):
|
|||
@coroutine
|
||||
async def migrate(config):
|
||||
"""Run database migrations"""
|
||||
# It’s mandatory to do it before the imports
|
||||
os.environ["ARGOS_YAML_FILE"] = config
|
||||
|
||||
# The imports are made here otherwise the agent will need server configuration files.
|
||||
from argos.server.settings import get_app_settings
|
||||
|
||||
os.environ["ARGOS_YAML_FILE"] = config
|
||||
|
||||
settings = get_app_settings()
|
||||
|
||||
current_dir = os.path.dirname(__file__)
|
||||
|
|
Loading…
Reference in a new issue