-
Notifications
You must be signed in to change notification settings - Fork 4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Diagram class related to #127 #135
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please run pylint on your python code and fix issues.
************* Module test
test.py:1:0: C0114: Missing module docstring (missing-module-docstring)
test.py:12:0: C0115: Missing class docstring (missing-class-docstring)
test.py:60:12: W0106: Expression "val1['obj'] >> Edge(label=self.d_LinkLabel(val1, val2)) << val2['obj']" is assigned to nothing (expression-not-assigned)
test.py:69:35: R1733: Unnecessary dictionary index lookup, use 'vals' instead (unnecessary-dict-index-lookup)
test.py:74:39: R1733: Unnecessary dictionary index lookup, use 'vals' instead (unnecessary-dict-index-lookup)
test.py:79:39: R1733: Unnecessary dictionary index lookup, use 'vals' instead (unnecessary-dict-index-lookup)
test.py:81:4: C0116: Missing function or method docstring (missing-function-docstring)
test.py:94:4: C0116: Missing function or method docstring (missing-function-docstring)
test.py:94:4: R1710: Either all return statements in a function should return an expression, or none of them should. (inconsistent-return-statements)
test.py:108:4: C0116: Missing function or method docstring (missing-function-docstring)
test.py:108:4: R1710: Either all return statements in a function should return an expression, or none of them should. (inconsistent-return-statements)
test.py:117:4: C0116: Missing function or method docstring (missing-function-docstring)
test.py:125:4: C0116: Missing function or method docstring (missing-function-docstring)
test.py:126:38: C0121: Comparison 'self.popreverse == None' should be 'self.popreverse is None' (singleton-comparison)
test.py:128:40: C0121: Comparison 'self.popreverse == False' should be 'self.popreverse is False' if checking for the singleton value False, or 'not self.popreverse' if testing for falsiness (singleton-comparison)
test.py:130:40: C0121: Comparison 'self.popreverse == True' should be 'self.popreverse is True' if checking for the singleton value True, or 'bool(self.popreverse)' if testing for truthiness (singleton-comparison)
test.py:133:4: C0116: Missing function or method docstring (missing-function-docstring)
test.py:140:19: R1714: Consider merging these comparisons with 'in' by using 'self.popreverse in (None, False)'. Use a set instead if elements are hashable. (consider-using-in)
test.py:140:19: C0121: Comparison 'self.popreverse == None' should be 'self.popreverse is None' (singleton-comparison)
test.py:140:46: C0121: Comparison 'self.popreverse == False' should be 'self.popreverse is False' if checking for the singleton value False, or 'not self.popreverse' if testing for falsiness (singleton-comparison)
test.py:142:21: C0121: Comparison 'self.popreverse == True' should be 'self.popreverse is True' if checking for the singleton value True, or 'self.popreverse' if testing for truthiness (singleton-comparison)
------------------------------------------------------------------
Your code has been rated at 8.26/10 (previous run: 6.03/10, +2.23)
for rcfile - use this one: https://github.com/sdn-sense/siterm/blob/master/standarts/pylintrc (We should also upload rcfile to this repo too)
Looks all good, one thing which is still missing is: You can see mermaid example here: https://autogole-grafana.nrp-nautilus.io/d/3634ecaa-6a1b-55d5-6464-292f22be058e/sc23-rucio-dmm-fnal-ucsd-flow-c33a01c3-e94f-4d4f-be7f-97bb1114bf10-2024-10-02-01-16-35-justas-dev?orgId=1 So it needs to include BGP information also to diagrams diagram. |
@juztas I added the BGP |
I see no bgp added |
#Generate Diagrams | ||
try: | ||
diagram_filename = f"{self.config.get('image_dir', '/srv/images')}/diagram_{kwargs['referenceUUID']}" | ||
DiagramWorker(self.orderlist).createGraph(diagram_filename) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should use class inheritance, same as we do for templates and other classes.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
got it
Idk what happened (base) sunami@Sunamis-MacBook-Pro packaging % git status
On branch imageserver
Changes not staged for commit:
(use "git add <file>..." to update what will be committed)
(use "git restore <file>..." to discard changes in working directory)
modified: files/etc/grid-security/hostcert.pem
modified: files/etc/grid-security/hostkey.pem
modified: files/etc/rtmon.yaml
modified: files/etc/sense-o-auth.yaml
modified: start-dev.sh
modified: ../src/python/RTMonLibs/DiagramWorker.py
modified: ../src/python/RTMonLibs/imageserver.py
Untracked files:
(use "git add <file>..." to include in what will be committed)
diagram.png
diagram2.png
../src/python/RTMonLibs/__pycache__/
no changes added to commit (use "git add" and/or "git commit -a")
(base) sunami@Sunamis-MacBook-Pro packaging % git add ../src/python/RTMonLibs/DiagramWorker.py
(base) sunami@Sunamis-MacBook-Pro packaging % git add ../src/python/RTMonLibs/DiagramWorker.py
(base) sunami@Sunamis-MacBook-Pro packaging % git commit -m "Added BGP"
[imageserver b6fd690] Added BGP
Committer: Sunami Dasgupta <[email protected]>
Your name and email address were configured automatically based
on your username and hostname. Please check that they are accurate.
You can suppress this message by setting them explicitly:
git config --global user.name "Your Name"
git config --global user.email [email protected]
After doing this, you may fix the identity used for this commit with:
git commit --amend --reset-author
1 file changed, 43 insertions(+)
(base) sunami@Sunamis-MacBook-Pro packaging % git push origin diagram-branch
Total 0 (delta 0), reused 0 (delta 0), pack-reused 0 (from 0)
To https://github.com/esnet/sense-rtmon/
f1fcc5d..98e18f4 diagram-branch -> diagram-branch
(base) sunami@Sunamis-MacBook-Pro packaging % git status
On branch imageserver
Changes not staged for commit:
(use "git add <file>..." to update what will be committed)
(use "git restore <file>..." to discard changes in working directory)
modified: files/etc/grid-security/hostcert.pem
modified: files/etc/grid-security/hostkey.pem
modified: files/etc/rtmon.yaml
modified: files/etc/sense-o-auth.yaml
modified: start-dev.sh
modified: ../src/python/RTMonLibs/imageserver.py
Untracked files:
(use "git add <file>..." to include in what will be committed)
diagram.png
diagram2.png
../src/python/RTMonLibs/__pycache__/
no changes added to commit (use "git add" and/or "git commit -a")
(base) sunami@Sunamis-MacBook-Pro packaging %
|
Based on output:
|
Oh Got it |
@juztas Let me do the class inheritance after image server. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am also missing bgp function in this pull request. Was it by mistake removed?
from diagrams import Diagram, Cluster, Edge | ||
from diagrams.custom import Custom | ||
from RTMonLibs.GeneralLibs import _processName | ||
# # change later: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
remove this code
HOST_ICON_PATH = '/srv/icons/host.png' | ||
SWITCH_ICON_PATH = '/srv/icons/switch.png' | ||
# # TEmp | ||
# HOST_ICON_PATH = '/Users/sunami/Desktop/publish/sense-rtmon/autogole-api/packaging/icons/host.png' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
remove too
|
||
from RTMonLibs.GeneralLibs import loadJson, dumpJson, dumpYaml, escape, getUUID, _processName | ||
from RTMonLibs.DiagramWorker import DiagramWorker | ||
#import json |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same here (why we need this commented line?)
#Generate Diagrams | ||
try: | ||
diagram_filename = f"{self.config.get('image_dir', '/srv/images')}/diagram_{kwargs['referenceUUID']}" | ||
# diagram_json = f"diagram_{kwargs['referenceUUID']}.json" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Similar here
one time I got this kind of error: Traceback (most recent call last):
File "src/python/RTMon/worker.py", line 272, in <module>
worker.startwork()
File "src/python/RTMon/worker.py", line 231, in startwork
self._startwork()
File "src/python/RTMon/worker.py", line 254, in _startwork
self.main()
File "src/python/RTMon/worker.py", line 218, in main
self.submit_exe(filename, fout)
File "src/python/RTMon/worker.py", line 50, in submit_exe
manifest = self.s_getManifest(instance)
File "/opt/devrtmon/src/python/RTMonLibs/SenseAPI.py", line 79, in s_getManifest
response = wApi.manifest_create(dumpJson(template, self.logger))
File "/usr/local/lib/python3.6/site-packages/sense/common.py", line 21, in wrapper
result = func(*args, **kwargs)
File "/usr/local/lib/python3.6/site-packages/sense/client/workflow_combined_api.py", line 680, in manifest_create
body_xml, **kwargs) # noqa: E501
File "/usr/local/lib/python3.6/site-packages/sense/common.py", line 21, in wrapper
result = func(*args, **kwargs)
File "/usr/local/lib/python3.6/site-packages/sense/client/workflow_combined_api.py", line 736, in instance_si_uuid_manifest_post_with_http_info
content_type='xml')
File "/usr/local/lib/python3.6/site-packages/sense/common.py", line 21, in wrapper
result = func(*args, **kwargs)
File "/usr/local/lib/python3.6/site-packages/sense/client/requestwrapper.py", line 156, in request
f"Returned code {ret.status_code} with error '{error_message}'")
ValueError: Returned code 500 with error 'Unexpected character ('<' (code 60)): expected a valid value (number, String, array, object, 'true', 'false' or 'null')
at [Source: (io.undertow.servlet.spec.ServletInputStreamImpl); line: 1, column: 2]' |
@sunami09 It would be more useful if you can provide the context of this error, such as service instance UUID. If that is gone, let's keep an eye on it and report it sooner next time you see it. |
graphviz
to the list of installed dependenciesdiagrams
package.host.png
,switch.png
) in/srv/icons/
for use in the diagram generation.DiagramWorker
class inRTMonLibs/DiagramWorker.py
responsible for generating network topology diagrams using thediagrams
package.worker.py
to delete generated diagram images when executions are deleted.DiagramWorker
into the template creation process/srv/images
with a unique reference ID for easy tracking.