Commit ba9393ba319e3dfc5ed597439ac4fe828afc6810
1 parent
cc7b66b3
Exists in
dev
Restructuration du projet - phase 1 : src/ => pyros_django/
Showing
10 changed files
with
30 additions
and
30 deletions
Show diff stats
.pydevproject
... | ... | @@ -19,7 +19,7 @@ |
19 | 19 | |
20 | 20 | <pydev_pathproperty name="org.python.pydev.PROJECT_SOURCE_PATH"> |
21 | 21 | |
22 | - <path>/${PROJECT_DIR_NAME}/src</path> | |
22 | + <path>/${PROJECT_DIR_NAME}/pyros_django</path> | |
23 | 23 | |
24 | 24 | <path>/${PROJECT_DIR_NAME}/simulators</path> |
25 | 25 | |
... | ... | @@ -41,7 +41,7 @@ |
41 | 41 | |
42 | 42 | |
43 | 43 | |
44 | - <value>src/manage.py</value> | |
44 | + <value>pyros_django/manage.py</value> | |
45 | 45 | |
46 | 46 | |
47 | 47 | ... | ... |
devices_channel/README.md
devices_channel/client/devices_abstract/device_controller_abstract.py
devices_channel/client/devices_abstract/plc_controller_abstract.py
devices_channel/client/devices_abstract/telescope_controller_abstract.py
pyros.py
... | ... | @@ -259,7 +259,7 @@ def shell(): |
259 | 259 | print() |
260 | 260 | print("Type 'exit()' to quit") |
261 | 261 | print() |
262 | - os.chdir("src/") | |
262 | + os.chdir("pyros_django/") | |
263 | 263 | # execProcess("python install.py install") |
264 | 264 | if not test_mode(): execProcessFromVenv("manage.py shell") |
265 | 265 | # Go back to the initial dir |
... | ... | @@ -276,7 +276,7 @@ def dbshell(): |
276 | 276 | print("Type 'exit' to quit") |
277 | 277 | print() |
278 | 278 | # execProcess("python install.py install") |
279 | - if not test_mode(): execProcessFromVenv("src/manage.py dbshell") | |
279 | + if not test_mode(): execProcessFromVenv("pyros_django/manage.py dbshell") | |
280 | 280 | # Go back to the initial dir |
281 | 281 | return True |
282 | 282 | |
... | ... | @@ -307,7 +307,7 @@ def test(): |
307 | 307 | apps = ['common', 'scheduler', 'routine_manager', 'user_manager', 'alert_manager.tests.TestStrategyChange'] |
308 | 308 | for app in apps: |
309 | 309 | _loaddata() or die() |
310 | - change_dir("src") | |
310 | + change_dir("pyros_django") | |
311 | 311 | execProcessFromVenv('manage.py test ' + app) or die() |
312 | 312 | change_dir("..") |
313 | 313 | # execProcess("python install.py install") |
... | ... | @@ -315,7 +315,7 @@ def test(): |
315 | 315 | |
316 | 316 | @pyros_launcher.command(help="Run ALL tests") |
317 | 317 | def testall(): |
318 | - change_dir("src") | |
318 | + change_dir("pyros_django") | |
319 | 319 | execProcessFromVenvAsync("manage.py test") |
320 | 320 | change_dir("..") |
321 | 321 | return True |
... | ... | @@ -425,11 +425,11 @@ def start(agent:str, configfile:str): |
425 | 425 | # Agent "webserver" |
426 | 426 | if agent_name == "webserver": |
427 | 427 | cmd = "manage.py runserver" |
428 | - os.chdir("src") | |
428 | + os.chdir("pyros_django") | |
429 | 429 | #if not test_mode(): execProcessFromVenv("start_agent.py " + agent_name + " " + configfile) |
430 | 430 | |
431 | 431 | elif agent_name == "agentM": |
432 | - os.chdir("src/monitoring/") | |
432 | + os.chdir("pyros_django/monitoring/") | |
433 | 433 | cmd = f"Agent{agent_name[5:]}.py" |
434 | 434 | if test_mode(): cmd += " -t" |
435 | 435 | if configfile: cmd += " {configfile}" |
... | ... | @@ -438,7 +438,7 @@ def start(agent:str, configfile:str): |
438 | 438 | elif agent_name.startswith("agent"): |
439 | 439 | # Run agent without actual commands sent to devices (FOR_REAL=False) |
440 | 440 | ##agentX.run(FOR_REAL=True) |
441 | - os.chdir("src/agent/") | |
441 | + os.chdir("pyros_django/agent/") | |
442 | 442 | #cmd = "-m AgentX" |
443 | 443 | #cmd = f" Agent{agent_name[5:]}.py {configfile}" |
444 | 444 | cmd = f"Agent{agent_name[5:]}.py" |
... | ... | @@ -507,14 +507,14 @@ def _update_python_packages_from_requirements(): |
507 | 507 | |
508 | 508 | def _update_plantuml_diags(): |
509 | 509 | res = False |
510 | - for dirpath, dirnames, files in os.walk('src'): | |
510 | + for dirpath, dirnames, files in os.walk('pyros_django'): | |
511 | 511 | if os.path.basename(dirpath) == "doc": |
512 | 512 | diagrams = glob.glob(dirpath+os.sep+"*.pu") |
513 | 513 | for diag in diagrams: res = execProcessFromVenv("-m plantuml "+diag) |
514 | 514 | return res |
515 | 515 | |
516 | 516 | def _migrate(): |
517 | - change_dir("src") | |
517 | + change_dir("pyros_django") | |
518 | 518 | # Migrate only migrations for the app "common" |
519 | 519 | #res = execProcessFromVenv("manage.py migrate common") |
520 | 520 | # Migrate all migrations for ALL apps |
... | ... | @@ -523,7 +523,7 @@ def _migrate(): |
523 | 523 | return res |
524 | 524 | |
525 | 525 | def _makemigrations(): |
526 | - change_dir("src") | |
526 | + change_dir("pyros_django") | |
527 | 527 | #execProcessFromVenv(self.venv_bin + " manage.py makemigrations") |
528 | 528 | #res = execProcessFromVenv("manage.py makemigrations common") |
529 | 529 | res = execProcessFromVenv("manage.py makemigrations") |
... | ... | @@ -532,7 +532,7 @@ def _makemigrations(): |
532 | 532 | |
533 | 533 | #TODO: mettre la fixture en date naive (sans time zone) |
534 | 534 | def _loaddata(): |
535 | - change_dir("src") | |
535 | + change_dir("pyros_django") | |
536 | 536 | #execProcessFromVenv(self.venv_bin + " manage.py loaddata misc" + os.sep + "fixtures" + os.sep + self.INIT_FIXTURE) |
537 | 537 | res = execProcessFromVenv("manage.py loaddata misc" + os.sep + "fixtures" + os.sep + INIT_FIXTURE) |
538 | 538 | change_dir("..") | ... | ... |
pyros_django/agent/Agent.py
... | ... | @@ -56,7 +56,7 @@ print("Starting with this sys.path", sys.path) |
56 | 56 | ##os.chdir("src") |
57 | 57 | print("Current directory : " + str(os.getcwd())) |
58 | 58 | |
59 | -os.environ.setdefault("DJANGO_SETTINGS_MODULE", "src.pyros.settings") | |
59 | +os.environ.setdefault("DJANGO_SETTINGS_MODULE", "pyros_django.pyros.settings") | |
60 | 60 | # os.environ['SECRET_KEY'] = 'abc' |
61 | 61 | # os.environ['ENVIRONMENT'] = 'production' |
62 | 62 | import django |
... | ... | @@ -377,7 +377,7 @@ class Agent: |
377 | 377 | config_filename = os.path.abspath(self.CONFIG_DIR + os.sep + config_filename) |
378 | 378 | # Remove "src/agent_name/" from abs dir : |
379 | 379 | # (1) Remove "src/" |
380 | - config_filename = config_filename.replace(os.sep+"src"+os.sep,os.sep) | |
380 | + config_filename = config_filename.replace(os.sep+"pyros_django"+os.sep,os.sep) | |
381 | 381 | # (2) Remove "agent_name/" |
382 | 382 | #TODO: bidouille, faire plus propre |
383 | 383 | config_filename = config_filename.replace(os.sep+"agent"+os.sep,os.sep) | ... | ... |
pyros_django/monitoring/AgentM.py
... | ... | @@ -10,11 +10,11 @@ import sys |
10 | 10 | |
11 | 11 | sys.path.append("..") |
12 | 12 | sys.path.append("../..") |
13 | -from src.agent.Agent import Agent, extract_parameters | |
13 | +from pyros_django.agent.Agent import Agent, extract_parameters | |
14 | 14 | |
15 | 15 | # PM 20190416 recycle code |
16 | -from src.devices.PLC import PLCController | |
17 | -from src.monitoring.plc_checker import PlcChecker | |
16 | +from pyros_django.devices.PLC import PLCController | |
17 | +from pyros_django.monitoring.plc_checker import PlcChecker | |
18 | 18 | from common.models import * |
19 | 19 | |
20 | 20 | ##log = L.setupLogger("AgentXTaskLogger", "AgentX") | ... | ... |
pyros_django/monitoring/tasks.py
... | ... | @@ -2,7 +2,7 @@ from __future__ import absolute_import |
2 | 2 | from django.conf import settings |
3 | 3 | from common.models import * |
4 | 4 | |
5 | -from src.monitoring.plc_checker import PlcChecker | |
5 | +from pyros_django.monitoring.plc_checker import PlcChecker | |
6 | 6 | from devices.PLC import PLCController |
7 | 7 | from utils.JDManipulator import * |
8 | 8 | import json | ... | ... |
start_agent.py
... | ... | @@ -85,24 +85,24 @@ if agent_name not in AGENTS: |
85 | 85 | sys.exit(1) |
86 | 86 | |
87 | 87 | if agent_name == "majordome": |
88 | - from src.majordome.tasks import Majordome | |
88 | + from pyros_django.majordome.tasks import Majordome | |
89 | 89 | Majordome().run(FOR_REAL=True) |
90 | 90 | sys.exit(0) |
91 | 91 | |
92 | 92 | if agent_name == "monitoring": |
93 | - from src.monitoring.tasks import Monitoring | |
93 | + from pyros_django.monitoring.tasks import Monitoring | |
94 | 94 | Monitoring().run() |
95 | 95 | sys.exit(0) |
96 | 96 | |
97 | 97 | if agent_name == "agentA": |
98 | - from src.agent.AgentA import AgentA | |
98 | + from pyros_django.agent.AgentA import AgentA | |
99 | 99 | agentA = AgentA(name="agentA", config_filename=configfile) |
100 | 100 | # Run agent without actual commands sent to devices (FOR_REAL=False) |
101 | 101 | agentA.run(FOR_REAL=True) |
102 | 102 | sys.exit(0) |
103 | 103 | |
104 | 104 | if agent_name == "agentM": |
105 | - from src.monitoring.AgentM import AgentM | |
105 | + from pyros_django.monitoring.AgentM import AgentM | |
106 | 106 | agentM = AgentM(name="agentM", config_filename=configfile) |
107 | 107 | # Run agent without actual commands sent to devices (FOR_REAL=False) |
108 | 108 | agentM.run(FOR_REAL=True) |
... | ... | @@ -116,7 +116,7 @@ agent.run(FOR_REAL=True) |
116 | 116 | |
117 | 117 | # Default agent is AgentX |
118 | 118 | |
119 | -from src.agent.AgentX import AgentX | |
119 | +from pyros_django.agent.AgentX import AgentX | |
120 | 120 | # AgentX().run(FOR_REAL=False) |
121 | 121 | agentX = AgentX(name="agentX", config_filename=configfile) |
122 | 122 | ... | ... |