mirror of
https://github.com/LibreQoE/LibreQoS.git
synced 2025-02-25 18:55:32 -06:00
Update the scheduler to use the latest config system
This commit is contained in:
@@ -74,6 +74,7 @@ fn liblqos_python(_py: Python, m: &PyModule) -> PyResult<()> {
|
|||||||
m.add_wrapped(wrap_pyfunction!(automatic_import_powercode))?;
|
m.add_wrapped(wrap_pyfunction!(automatic_import_powercode))?;
|
||||||
m.add_wrapped(wrap_pyfunction!(powercode_api_key))?;
|
m.add_wrapped(wrap_pyfunction!(powercode_api_key))?;
|
||||||
m.add_wrapped(wrap_pyfunction!(powercode_api_url))?;
|
m.add_wrapped(wrap_pyfunction!(powercode_api_url))?;
|
||||||
|
m.add_wrapped(wrap_pyfunction!(automatic_import_sonar))?;
|
||||||
|
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
@@ -554,3 +555,9 @@ fn powercode_api_url() -> PyResult<String> {
|
|||||||
let config = lqos_config::load_config().unwrap();
|
let config = lqos_config::load_config().unwrap();
|
||||||
Ok(config.powercode_integration.powercode_api_url)
|
Ok(config.powercode_integration.powercode_api_url)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[pyfunction]
|
||||||
|
fn automatic_import_sonar() -> PyResult<bool> {
|
||||||
|
let config = lqos_config::load_config().unwrap();
|
||||||
|
Ok(config.sonar_integration.enable_sonar)
|
||||||
|
}
|
||||||
@@ -2,22 +2,15 @@ import time
|
|||||||
import datetime
|
import datetime
|
||||||
from LibreQoS import refreshShapers, refreshShapersUpdateOnly
|
from LibreQoS import refreshShapers, refreshShapersUpdateOnly
|
||||||
#from graphInfluxDB import refreshBandwidthGraphs, refreshLatencyGraphs
|
#from graphInfluxDB import refreshBandwidthGraphs, refreshLatencyGraphs
|
||||||
from liblqos_python import automatic_import_uisp, automatic_import_splynx, queue_refresh_interval_mins
|
from liblqos_python import automatic_import_uisp, automatic_import_splynx, queue_refresh_interval_mins, \
|
||||||
|
automatic_import_powercode, automatic_import_sonar
|
||||||
if automatic_import_uisp():
|
if automatic_import_uisp():
|
||||||
from integrationUISP import importFromUISP
|
from integrationUISP import importFromUISP
|
||||||
if automatic_import_splynx():
|
if automatic_import_splynx():
|
||||||
from integrationSplynx import importFromSplynx
|
from integrationSplynx import importFromSplynx
|
||||||
try:
|
if automatic_import_powercode():
|
||||||
from ispConfig import automaticImportPowercode
|
|
||||||
except:
|
|
||||||
automaticImportPowercode = False
|
|
||||||
if automaticImportPowercode:
|
|
||||||
from integrationPowercode import importFromPowercode
|
from integrationPowercode import importFromPowercode
|
||||||
try:
|
if automatic_import_sonar():
|
||||||
from ispConfig import automaticImportSonar
|
|
||||||
except:
|
|
||||||
automaticImportSonar = False
|
|
||||||
if automaticImportSonar:
|
|
||||||
from integrationSonar import importFromSonar
|
from integrationSonar import importFromSonar
|
||||||
from apscheduler.schedulers.background import BlockingScheduler
|
from apscheduler.schedulers.background import BlockingScheduler
|
||||||
from apscheduler.executors.pool import ThreadPoolExecutor
|
from apscheduler.executors.pool import ThreadPoolExecutor
|
||||||
@@ -35,12 +28,12 @@ def importFromCRM():
|
|||||||
importFromSplynx()
|
importFromSplynx()
|
||||||
except:
|
except:
|
||||||
print("Failed to import from Splynx")
|
print("Failed to import from Splynx")
|
||||||
elif automaticImportPowercode:
|
elif automatic_import_powercode():
|
||||||
try:
|
try:
|
||||||
importFromPowercode()
|
importFromPowercode()
|
||||||
except:
|
except:
|
||||||
print("Failed to import from Powercode")
|
print("Failed to import from Powercode")
|
||||||
elif automaticImportSonar:
|
elif automatic_import_sonar():
|
||||||
try:
|
try:
|
||||||
importFromSonar()
|
importFromSonar()
|
||||||
except:
|
except:
|
||||||
|
|||||||
Reference in New Issue
Block a user