quarchpy 2.1.20.dev2__py2.py3-none-any.whl → 2.1.20.dev3__py2.py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (150) hide show
  1. quarchpy/.idea/.name +1 -1
  2. quarchpy/.idea/inspectionProfiles/Project_Default.xml +26 -0
  3. quarchpy/.idea/modules.xml +0 -1
  4. quarchpy/.idea/quarchpy.iml +1 -4
  5. quarchpy/.idea/workspace.xml +21 -226
  6. quarchpy/__pycache__/__init__.cpython-311.pyc +0 -0
  7. quarchpy/__pycache__/_version.cpython-311.pyc +0 -0
  8. quarchpy/__pycache__/connection.cpython-311.pyc +0 -0
  9. quarchpy/__pycache__/run.cpython-311.pyc +0 -0
  10. quarchpy/_version.py +1 -1
  11. quarchpy/config_files/__pycache__/__init__.cpython-311.pyc +0 -0
  12. quarchpy/config_files/__pycache__/quarch_config_parser.cpython-311.pyc +0 -0
  13. quarchpy/connection_specific/QPS/qis/help.txt +12 -4
  14. quarchpy/connection_specific/QPS/qis/qis.jar +0 -0
  15. quarchpy/connection_specific/QPS/qis/qis_lib/CInterface-1.7.8.jar +0 -0
  16. quarchpy/connection_specific/QPS/qis/qis_lib/Collections-2.4.jar +0 -0
  17. quarchpy/connection_specific/QPS/qis/qis_lib/Desktop-1.1.jar +0 -0
  18. quarchpy/connection_specific/QPS/qis/qis_lib/Executor-3.13.jar +0 -0
  19. quarchpy/connection_specific/QPS/qis/qis_lib/JNA-1.2.jar +0 -0
  20. quarchpy/connection_specific/QPS/qis/qis_lib/OS-1.8.jar +0 -0
  21. quarchpy/connection_specific/QPS/qis/qis_lib/QuarchCommon-0.2.9.jar +0 -0
  22. quarchpy/connection_specific/QPS/qis/qis_lib/SystemTray-4.4.jar +0 -0
  23. quarchpy/connection_specific/QPS/qis/qis_lib/Updates-1.1.jar +0 -0
  24. quarchpy/connection_specific/QPS/qis/qis_lib/Utilities-1.46.jar +0 -0
  25. quarchpy/connection_specific/QPS/qis/qis_lib/commons-csv-1.8.jar +0 -0
  26. quarchpy/connection_specific/QPS/qis/qis_lib/javassist-3.29.2-GA.jar +0 -0
  27. quarchpy/connection_specific/QPS/qis/qis_lib/jna-jpms-5.12.1.jar +0 -0
  28. quarchpy/connection_specific/QPS/qis/qis_lib/jna-platform-jpms-5.12.1.jar +0 -0
  29. quarchpy/connection_specific/QPS/qis/qis_lib/kotlin-stdlib-1.9.21.jar +0 -0
  30. quarchpy/connection_specific/QPS/qis/qis_lib/slf4j-api-2.0.9.jar +0 -0
  31. quarchpy/connection_specific/QPS/qis/qis_lib/slf4j-simple-2.0.9.jar +0 -0
  32. quarchpy/connection_specific/QPS/qis/resources/filters/Example.txt +36 -0
  33. quarchpy/connection_specific/QPS/qis/resources/filters/filters.csv +1004 -0
  34. quarchpy/connection_specific/QPS/qis/resources/filters/iec_filters.xml +26 -0
  35. quarchpy/connection_specific/QPS/qis/resources/filters/iec_filters.xml.bak +26 -0
  36. quarchpy/connection_specific/QPS/qps.jar +0 -0
  37. quarchpy/connection_specific/QPS/qps_lib/QuarchCommon-0.2.9.jar +0 -0
  38. quarchpy/connection_specific/QPS/qps_lib/commons-lang3-3.12.0.jar +0 -0
  39. quarchpy/connection_specific/QPS/qps_lib/opencsv-5.9.jar +0 -0
  40. quarchpy/connection_specific/QPS/qps_lib/qis-1.40.jar +0 -0
  41. quarchpy/connection_specific/QPS/scriptCommands.txt +2 -2
  42. quarchpy/connection_specific/__pycache__/StreamChannels.cpython-311.pyc +0 -0
  43. quarchpy/connection_specific/__pycache__/__init__.cpython-311.pyc +0 -0
  44. quarchpy/connection_specific/__pycache__/connection_QIS.cpython-311.pyc +0 -0
  45. quarchpy/connection_specific/__pycache__/connection_QPS.cpython-311.pyc +0 -0
  46. quarchpy/connection_specific/__pycache__/connection_ReST.cpython-311.pyc +0 -0
  47. quarchpy/connection_specific/__pycache__/connection_Serial.cpython-311.pyc +0 -0
  48. quarchpy/connection_specific/__pycache__/connection_TCP.cpython-311.pyc +0 -0
  49. quarchpy/connection_specific/__pycache__/connection_Telnet.cpython-311.pyc +0 -0
  50. quarchpy/connection_specific/__pycache__/connection_USB.cpython-311.pyc +0 -0
  51. quarchpy/connection_specific/__pycache__/connection_mDNS.cpython-311.pyc +0 -0
  52. quarchpy/connection_specific/connection_QIS.py +5 -3
  53. quarchpy/connection_specific/connection_QIS.py.bak +1738 -0
  54. quarchpy/connection_specific/serial/__pycache__/__init__.cpython-311.pyc +0 -0
  55. quarchpy/connection_specific/serial/__pycache__/serialutil.cpython-311.pyc +0 -0
  56. quarchpy/connection_specific/serial/__pycache__/serialwin32.cpython-311.pyc +0 -0
  57. quarchpy/connection_specific/serial/__pycache__/win32.cpython-311.pyc +0 -0
  58. quarchpy/connection_specific/serial/tools/__pycache__/__init__.cpython-311.pyc +0 -0
  59. quarchpy/connection_specific/serial/tools/__pycache__/list_ports.cpython-311.pyc +0 -0
  60. quarchpy/connection_specific/serial/tools/__pycache__/list_ports_common.cpython-311.pyc +0 -0
  61. quarchpy/connection_specific/serial/tools/__pycache__/list_ports_windows.cpython-311.pyc +0 -0
  62. quarchpy/connection_specific/usb_libs/__pycache__/libusb1.cpython-311.pyc +0 -0
  63. quarchpy/connection_specific/usb_libs/__pycache__/usb1.cpython-311.pyc +0 -0
  64. quarchpy/debug/TextScanIP.py +11 -0
  65. quarchpy/debug/__pycache__/SystemTest.cpython-311.pyc +0 -0
  66. quarchpy/debug/__pycache__/__init__.cpython-311.pyc +0 -0
  67. quarchpy/debug/__pycache__/module_debug.cpython-311.pyc +0 -0
  68. quarchpy/debug/__pycache__/simple_terminal.cpython-311.pyc +0 -0
  69. quarchpy/debug/__pycache__/upgrade_quarchpy.cpython-311.pyc +0 -0
  70. quarchpy/debug/__pycache__/versionCompare.cpython-311.pyc +0 -0
  71. quarchpy/device/__pycache__/__init__.cpython-311.pyc +0 -0
  72. quarchpy/device/__pycache__/device.cpython-311.pyc +0 -0
  73. quarchpy/device/__pycache__/quarchArray.cpython-311.pyc +0 -0
  74. quarchpy/device/__pycache__/quarchPPM.cpython-311.pyc +0 -0
  75. quarchpy/device/__pycache__/quarchQPS.cpython-311.pyc +0 -0
  76. quarchpy/device/__pycache__/scanDevices.cpython-311.pyc +0 -0
  77. quarchpy/device/device.py.bak +504 -0
  78. quarchpy/device/quarchPPM.py.bak +67 -0
  79. quarchpy/device/quarchQPS.py.bak +396 -0
  80. quarchpy/device/scanDevices.py.bak +130 -108
  81. quarchpy/disk_test/__pycache__/AbsDiskFinder.cpython-311.pyc +0 -0
  82. quarchpy/disk_test/__pycache__/DiskTargetSelection.cpython-311.pyc +0 -0
  83. quarchpy/disk_test/__pycache__/__init__.cpython-311.pyc +0 -0
  84. quarchpy/disk_test/__pycache__/iometerDiskFinder.cpython-311.pyc +0 -0
  85. quarchpy/docs/CHANGES.rst.bak +4 -2
  86. quarchpy/docs/_build/doctrees/CHANGES.doctree +0 -0
  87. quarchpy/docs/_build/doctrees/environment.pickle +0 -0
  88. quarchpy/docs/_build/doctrees/source/changelog.doctree +0 -0
  89. quarchpy/docs/_build/doctrees/source/quarchpy.fio.doctree +0 -0
  90. quarchpy/docs/_build/html/CHANGES.html +121 -113
  91. quarchpy/docs/_build/html/_sources/CHANGES.rst.txt +6 -1
  92. quarchpy/docs/_build/html/_static/alabaster.css +14 -9
  93. quarchpy/docs/_build/html/_static/basic.css +1 -1
  94. quarchpy/docs/_build/html/_static/pygments.css +1 -1
  95. quarchpy/docs/_build/html/genindex.html +9 -27
  96. quarchpy/docs/_build/html/index.html +62 -60
  97. quarchpy/docs/_build/html/objects.inv +0 -0
  98. quarchpy/docs/_build/html/py-modindex.html +7 -11
  99. quarchpy/docs/_build/html/readme.html +7 -6
  100. quarchpy/docs/_build/html/search.html +7 -6
  101. quarchpy/docs/_build/html/searchindex.js +1 -1
  102. quarchpy/docs/_build/html/source/changelog.html +176 -167
  103. quarchpy/docs/_build/html/source/licenses.html +7 -6
  104. quarchpy/docs/_build/html/source/modules.html +8 -7
  105. quarchpy/docs/_build/html/source/quarchpy.calibration.html +7 -6
  106. quarchpy/docs/_build/html/source/quarchpy.config_files.html +7 -6
  107. quarchpy/docs/_build/html/source/quarchpy.connection_specific.html +7 -6
  108. quarchpy/docs/_build/html/source/quarchpy.debug.html +7 -6
  109. quarchpy/docs/_build/html/source/quarchpy.device.html +7 -6
  110. quarchpy/docs/_build/html/source/quarchpy.disk_test.html +7 -6
  111. quarchpy/docs/_build/html/source/quarchpy.fio.html +9 -34
  112. quarchpy/docs/_build/html/source/quarchpy.html +8 -16
  113. quarchpy/docs/_build/html/source/quarchpy.iometer.html +7 -6
  114. quarchpy/docs/_build/html/source/quarchpy.qis.html +7 -6
  115. quarchpy/docs/_build/html/source/quarchpy.qps.html +7 -6
  116. quarchpy/docs/_build/html/source/quarchpy.user_interface.html +7 -6
  117. quarchpy/docs/_build/html/source/quarchpy.utilities.html +7 -6
  118. quarchpy/docs/_build/html/source/readme.html +7 -6
  119. quarchpy/fio/__pycache__/FIO_interface.cpython-311.pyc +0 -0
  120. quarchpy/fio/__pycache__/__init__.cpython-311.pyc +0 -0
  121. quarchpy/fio/__pycache__/fioDiskFinder.cpython-311.pyc +0 -0
  122. quarchpy/iometer/__pycache__/__init__.cpython-311.pyc +0 -0
  123. quarchpy/iometer/__pycache__/gen_iometer_template.cpython-311.pyc +0 -0
  124. quarchpy/iometer/__pycache__/iometerFuncs.cpython-311.pyc +0 -0
  125. quarchpy/qis/__pycache__/StreamHeaderInfo.cpython-311.pyc +0 -0
  126. quarchpy/qis/__pycache__/__init__.cpython-311.pyc +0 -0
  127. quarchpy/qis/__pycache__/qisFuncs.cpython-311.pyc +0 -0
  128. quarchpy/qps/__pycache__/__init__.cpython-311.pyc +0 -0
  129. quarchpy/qps/__pycache__/qpsFuncs.cpython-311.pyc +0 -0
  130. quarchpy/qps/qpsFuncs.py.bak +28 -68
  131. quarchpy/user_interface/__pycache__/__init__.cpython-311.pyc +0 -0
  132. quarchpy/user_interface/__pycache__/user_interface.cpython-311.pyc +0 -0
  133. quarchpy/user_interface/user_interface.py.bak +749 -0
  134. quarchpy/utilities/TestCenter.py.bak +150 -0
  135. quarchpy/utilities/__pycache__/BitManipulation.cpython-311.pyc +0 -0
  136. quarchpy/utilities/__pycache__/TestCenter.cpython-311.pyc +0 -0
  137. quarchpy/utilities/__pycache__/TimeValue.cpython-311.pyc +0 -0
  138. quarchpy/utilities/__pycache__/Version.cpython-311.pyc +0 -0
  139. quarchpy/utilities/__pycache__/__init__.cpython-311.pyc +0 -0
  140. {quarchpy-2.1.20.dev2.dist-info → quarchpy-2.1.20.dev3.dist-info}/METADATA +1 -1
  141. {quarchpy-2.1.20.dev2.dist-info → quarchpy-2.1.20.dev3.dist-info}/RECORD +143 -114
  142. quarchpy/_version.py.bak +0 -1
  143. quarchpy/connection_specific/connection_mDNS.py.bak +0 -48
  144. quarchpy/debug/SystemTest.py.bak +0 -188
  145. quarchpy/debug/simple_terminal.py.bak +0 -50
  146. quarchpy/fio/FIO_interface.py.bak +0 -322
  147. quarchpy/qis/qisFuncs.py.bak +0 -265
  148. quarchpy/run.py.bak +0 -283
  149. {quarchpy-2.1.20.dev2.dist-info → quarchpy-2.1.20.dev3.dist-info}/WHEEL +0 -0
  150. {quarchpy-2.1.20.dev2.dist-info → quarchpy-2.1.20.dev3.dist-info}/top_level.txt +0 -0
@@ -1,188 +0,0 @@
1
- from quarchpy import *
2
- from quarchpy.device import *
3
- from importlib.metadata import distribution
4
- import os
5
- import platform
6
- import sys
7
- import subprocess
8
- from quarchpy._version import __version__
9
-
10
- def test_communication():
11
- print("")
12
- print("DEVICE COMMUNICATION TEST")
13
- print("-------------------------")
14
- print("")
15
- deviceList = scanDevices('all', favouriteOnly=False)
16
- print("Devices visible:\r\n" + str(deviceList))
17
- print("")
18
- moduleStr = userSelectDevice(deviceList, nice=True, additionalOptions=["Rescan", "Quit", "All Conn Types"])
19
- if moduleStr == "quit":
20
- print("User selected quit")
21
- return 0
22
- print("Selected module is: " + moduleStr)
23
- # Create a device using the module connection string
24
- myDevice = getQuarchDevice(moduleStr)
25
- QuarchSimpleIdentify(myDevice)
26
- # Close the module before exiting the script
27
- myDevice.closeConnection()
28
-
29
- def test_system_info():
30
- print("")
31
- print("SYSTEM INFORMATION")
32
- print("------------------")
33
- print("OS Name: " + os.name)
34
- print("Platform System: " + platform.system())
35
- print("Platform: " + platform.platform())
36
- if "nt" in os.name: print("Platform Architecture: " + platform.architecture()[0])
37
- print("Platform Release: " + platform.release())
38
- try:
39
- print("Quarchpy Version: " + get_quarchpy_version())
40
- except:
41
- print("Unable to detect Quarchpy version")
42
- try:
43
- print("Quarchpy info Location: " + str(distribution("quarchpy")._path))
44
- except Exception as e:
45
- print(e)
46
- print("Unable to detect Quarchpy location")
47
- try:
48
- print("Python Version: " + sys.version)
49
- except:
50
- print("Unable to detect Python version")
51
- try:
52
- print("QIS version number: " + get_QIS_version())
53
- except:
54
- print("Unable to detect QIS version")
55
- try:
56
- javaVersion = bytes(subprocess.check_output(['java', '-version'], stderr=subprocess.STDOUT)).decode()
57
- print("Java Version: " + str(javaVersion))
58
- except:
59
- print("Unable to detect java version"
60
- "If Java is not installed then QIS and QPS will NOT run")
61
- try:
62
- javaLocation = get_java_location()
63
- print("Java Location: " + str(javaLocation))
64
- except:
65
- print("Unable to detect java location"
66
- "If Java is not installed then QIS and QPS will NOT run")
67
-
68
- # Scan for all quarch devices on the system
69
-
70
- def QuarchSimpleIdentify(device1):
71
- """
72
- Prints basic identification test data on the specified module, compatible with all Quarch devices
73
-
74
- Parameters
75
- ----------
76
- device1: quarchDevice
77
- Open connection to a quarch device
78
-
79
- """
80
- # Print the module name
81
- print("MODULE IDENTIFY TEST")
82
- print("--------------------")
83
- print("")
84
- print("Module Name: "),
85
- print(device1.sendCommand("hello?"))
86
- print("")
87
- # Print the module identify and version information
88
- print("Module Identity Information: ")
89
- print(device1.sendCommand("*idn?"))
90
-
91
- def get_QIS_version():
92
- """
93
- Returns the version of QIS. This is the version of QIS currenty running on the local system if one exists.
94
- Otherwise the local version within quarchpy will be exectued and its version returned.
95
-
96
- Returns
97
- -------
98
- version: str
99
- String representation of the QIS version number
100
-
101
- """
102
-
103
- qis_version = ""
104
- my_close_qis = False
105
- if isQisRunning() == False:
106
- my_close_qis = True
107
- startLocalQis(headless=True)
108
-
109
- myQis = qisInterface()
110
- qis_version = myQis.sendAndReceiveCmd(cmd="$version")
111
- if "No Target Device Specified" in qis_version:
112
- qis_version = myQis.sendAndReceiveCmd(cmd="$help").split("\r\n")[0]
113
- if my_close_qis:
114
- myQis.sendAndReceiveCmd(cmd = "$shutdown")
115
- return qis_version
116
-
117
- def get_java_location():
118
- """
119
- Returns the location of java.
120
-
121
- Returns
122
- -------
123
- location: str
124
- String representation of the java location.
125
- """
126
- if "windows" in platform.platform().lower():
127
- location = bytes(subprocess.check_output(['where', 'java'], stderr=subprocess.STDOUT)).decode()
128
- elif "linux" in platform.platform().lower():
129
- location = bytes(subprocess.check_output(['whereis', 'java'], stderr=subprocess.STDOUT)).decode()
130
- else:
131
- location = "Unable to detect OS to check java version."
132
- return location
133
-
134
- def get_quarchpy_version():
135
- try:
136
- return __version__
137
- except:
138
- return "Unknown"
139
-
140
- def fix_usb():
141
- content_to_write = "SUBSYSTEM==\"usb\", ATTRS{idVendor}==\"16d0\", MODE=\"0666\"" \
142
- "SUBSYSTEM==\"usb_device\", ATTRS{idVendor}==\"16d0\", MODE=\"0666\""
143
-
144
- if "centos" in str(platform.platform()).lower():
145
- content_to_write = "SUBSYSTEM==\"usb\", ATTRS{idVendor}==\"16d0\", MODE=\"0666\", GROUP=*\n " \
146
- "SUBSYSTEM==\"usb_device\", ATTRS{idVendor}==\"16d0\", MODE=\"0666\", GROUP=*"
147
-
148
- destination = "/etc/udev/rules.d/20-quarchmodules.rules"
149
-
150
- f = open("/etc/udev/rules.d/20-quarchmodules.rules", "w")
151
- f.write(content_to_write)
152
- f.close()
153
-
154
- os.system("udevadm control --reload")
155
- os.system("udevadm trigger")
156
-
157
- print("USB rule added to file : /etc/udev/rules.d/20-quarchmodules.rules")
158
-
159
-
160
- def main (args=None):
161
- """
162
- Main function to allow the system test to be called direct from the command line
163
- """
164
- bool_test_system_info = True
165
- bool_test_communication = True
166
- bool_fixusb=False
167
- if args is not None and len(args)>0:
168
- for arg in args:
169
- if "--fixusb" in str(arg).lower():
170
- bool_fixusb=True
171
- # todo: Should we still be running the debug info stuff after this?
172
- if "--skipsysteminfo" in str(arg).lower():
173
- bool_test_system_info=False
174
- if "--skipcommstest" in str(arg).lower():
175
- bool_test_communication=False
176
-
177
- if bool_fixusb:
178
- fix_usb()
179
- if bool_test_system_info:
180
- test_system_info()
181
- if bool_test_communication:
182
- test_communication()
183
-
184
-
185
- if __name__ == "__main__":
186
- main([])
187
- #main(["--skipSystemInfo","--skipCommsTest"])
188
- #main(["--fixusb"])
@@ -1,50 +0,0 @@
1
- """
2
- This is a very simple terminal program for basic communication to quarch modules.
3
- Feel free to expand and add your own features to this.
4
-
5
- ########### VERSION HISTORY ###########
6
-
7
- 26/11/2020 - Stuart Boon - First Version
8
-
9
- ########### INSTRUCTIONS ###########
10
- Select the module you would like to talk to.
11
- Type desired command
12
- Read response
13
- """
14
- from quarchpy import *
15
- from quarchpy.device import *
16
- from quarchpy.user_interface import*
17
- from quarchpy._version import __version__ as quarchpyVersion
18
- def main():
19
- printText("Quarchpy v"+str(quarchpyVersion))
20
- myDevice =""
21
- while myDevice != "shutdown":
22
- moduleStr = userSelectDevice(nice=True, additionalOptions=["Rescan","All Conn Types", "Specify IP Address", "Quit"])
23
- #moduleStr = "TCP:1999-05-005"
24
- if moduleStr == "quit":
25
- return 0
26
- printText("Selected module is: " + moduleStr)
27
- # Create a device using the module connection string
28
- #moduleStr = "REST:1995-05-005"
29
- myDevice = getQuarchDevice(moduleStr)
30
-
31
- while myDevice !=None and myDevice!="shutdown":
32
- user_input = requestDialog("","Send command to " + str(moduleStr) + " :")
33
- #Dollar commands are to be handled by the terminal
34
- if user_input.startswith("$"):
35
- if "$shutdown" in user_input.lower().replace(" ",""):
36
- printText("Have a nice day!")
37
- myDevice="shutdown"
38
- elif "$close connection" in user_input.lower():
39
- myDevice.closeConnection()
40
- myDevice=None
41
- pass
42
- #All other commands are passed to the module
43
- else:
44
- printText(myDevice.sendCommand(user_input))
45
-
46
-
47
-
48
- if __name__ == "__main__":
49
- while True:
50
- main()
@@ -1,322 +0,0 @@
1
- import os
2
- import time
3
- import json
4
- from datetime import datetime
5
- import subprocess
6
-
7
- all_outputs={"terse_version_3":"0",
8
- "fio_version":"1",
9
- "jobname":"2",
10
- "groupid":"3",
11
- "error":"4",
12
- "read_kb":"5",
13
- "read_bandwidth":"6",
14
- "read_iops":"7",
15
- "read_runtime_ms":"8",
16
- "read_slat_min":"9",
17
- "read_slat_max":"10",
18
- "read_slat_mean":"11",
19
- "read_slat_dev":"12",
20
- "read_clat_min":"13",
21
- "read_clat_max":"14",
22
- "read_clat_mean":"15",
23
- "read_clat_dev":"16",
24
- "read_clat_pct01":"17",
25
- "read_clat_pct02":"18",
26
- "read_clat_pct03":"19",
27
- "read_clat_pct04":"20",
28
- "read_clat_pct05":"21",
29
- "read_clat_pct06":"22",
30
- "read_clat_pct07":"23",
31
- "read_clat_pct08":"24",
32
- "read_clat_pct09":"25",
33
- "read_clat_pct10":"26",
34
- "read_clat_pct11":"27",
35
- "read_clat_pct12":"28",
36
- "read_clat_pct13":"29",
37
- "read_clat_pct14":"30",
38
- "read_clat_pct15":"31",
39
- "read_clat_pct16":"32",
40
- "read_clat_pct17":"33",
41
- "read_clat_pct18":"34",
42
- "read_clat_pct19":"35",
43
- "read_clat_pct20":"36",
44
- "read_tlat_min":"37",
45
- "read_lat_max":"38",
46
- "read_lat_mean":"39",
47
- "read_lat_dev":"40",
48
- "read_bw_min":"41",
49
- "read_bw_max":"42",
50
- "read_bw_agg_pct":"43",
51
- "read_bw_mean":"44",
52
- "read_bw_dev":"45",
53
- "write_kb":"46",
54
- "write_bandwidth":"47",
55
- "write_iops":"48",
56
- "write_runtime_ms":"49",
57
- "write_slat_min":"50",
58
- "write_slat_max":"51",
59
- "write_slat_mean":"52",
60
- "write_slat_dev":"53",
61
- "write_clat_min":"54",
62
- "write_clat_max":"55",
63
- "write_clat_mean":"56",
64
- "write_clat_dev":"57",
65
- "write_clat_pct01":"58",
66
- "write_clat_pct02":"59",
67
- "write_clat_pct03":"60",
68
- "write_clat_pct04":"61",
69
- "write_clat_pct05":"62",
70
- "write_clat_pct06":"63",
71
- "write_clat_pct07":"64",
72
- "write_clat_pct08":"65",
73
- "write_clat_pct09":"66",
74
- "write_clat_pct10":"67",
75
- "write_clat_pct11":"68",
76
- "write_clat_pct12":"69",
77
- "write_clat_pct13":"70",
78
- "write_clat_pct14":"71",
79
- "write_clat_pct15":"72",
80
- "write_clat_pct16":"73",
81
- "write_clat_pct17":"74",
82
- "write_clat_pct18":"75",
83
- "write_clat_pct19":"76",
84
- "write_clat_pct20":"77",
85
- "write_tlat_min":"78",
86
- "write_lat_max":"79",
87
- "write_lat_mean":"80",
88
- "write_lat_dev":"81",
89
- "write_bw_min":"82",
90
- "write_bw_max":"83",
91
- "write_bw_agg_pct":"84",
92
- "write_bw_mean":"85",
93
- "write_bw_dev":"86",
94
- "cpu_user":"87",
95
- "cpu_sys":"88",
96
- "cpu_csw":"89",
97
- "cpu_mjf":"90",
98
- "cpu_minf":"91",
99
- "iodepth_1":"92",
100
- "iodepth_2":"93",
101
- "iodepth_4":"94",
102
- "iodepth_8":"95",
103
- "iodepth_16":"96",
104
- "iodepth_32":"97",
105
- "iodepth_64":"98",
106
- "lat_2us":"99",
107
- "lat_4us":"100",
108
- "lat_10us":"101",
109
- "lat_20us":"102",
110
- "lat_50us":"103",
111
- "lat_100us":"104",
112
- "lat_250us":"105",
113
- "lat_500us":"106",
114
- "lat_750us":"107",
115
- "lat_1000us":"108",
116
- "lat_2ms":"109",
117
- "lat_4ms":"110",
118
- "lat_10ms":"111",
119
- "lat_20ms":"112",
120
- "lat_50ms":"113",
121
- "lat_100ms":"114",
122
- "lat_250ms":"115",
123
- "lat_500ms":"116",
124
- "lat_750ms":"117",
125
- "lat_1000ms":"118",
126
- "lat_2000ms":"119",
127
- "lat_over_2000ms":"120",
128
- "disk_name":"121",
129
- "disk_read_iops":"122",
130
- "disk_write_iops":"123",
131
- "disk_read_merges":"124",
132
- "disk_write_merges":"125",
133
- "disk_read_ticks":"126",
134
- "write_ticks":"127",
135
- "disk_queue_time":"128",
136
- "disk_util":"129"}
137
-
138
- out_data = {}
139
-
140
- def timeNow():
141
- return datetime.now().strftime("%Y-%m-%d %H:%M:%S:%f")
142
-
143
- def adjustTime(timestamp):
144
- return time.mktime(datetime.strptime(timestamp, "%Y-%m-%d %H:%M:%S:%f").timetuple())
145
-
146
-
147
- def follow(thefile, p):
148
- thefile.seek(0,2)
149
- #flag for exiting the loop
150
- processCompleted = False
151
-
152
- while processCompleted == False:
153
- line = thefile.readline()
154
-
155
- #only exists if process is finished and no more data from file
156
- if p.poll() is not None and not line:
157
- #yield a specific string we can identify
158
- yield ("quarch_end_Process")
159
- processCompleted = True
160
-
161
- if not line:
162
- time.sleep(0.1)
163
- continue
164
- yield line
165
-
166
-
167
- def return_data(output_file, p, fioCallbacks, myStream, user_data, arguments):
168
-
169
- isThreaded = True
170
- #checking to see if the first line of file needs to be skipped = Windows only
171
- if os.name == "nt":
172
- isThreaded = False
173
- for i in arguments:
174
- #only needs to be skipped if the "thread" argument has not been issued
175
- if (str(i.lower()) == "thread"):
176
- isThreaded = True
177
-
178
- info_out = {}
179
- logfile = open(output_file,"r")
180
- loglines = follow(logfile, p)
181
-
182
- #variables for parsing json
183
- iterator = 0
184
- jobCount = 0
185
- jsonLines = ""
186
- openBracketCount = 0
187
- closeBracketCount = 0
188
- # Init the job end time to the current start time
189
- jobEndTime = int(round(time.time() * 1000))
190
-
191
- for line in loglines:
192
-
193
-
194
- if (isThreaded == False):
195
- #skip the very first line -- (title line) --
196
- if iterator == 0:
197
- iterator = iterator + 1
198
- #marking threaded as true for remainder of read > Efficiency
199
- isThreaded = True
200
- continue
201
-
202
- #add to iterator - not needed, may be useful later
203
- iterator = iterator + 1
204
-
205
- #concat strings
206
- jsonLines += line
207
-
208
- #finding brackets withing json
209
- if '{' in line:
210
- openBracketCount = openBracketCount + 1
211
- if '}' in line:
212
- closeBracketCount = closeBracketCount + 1
213
-
214
- #an equal amount of brackets denotes the end of a json object
215
- if openBracketCount == closeBracketCount and openBracketCount != 0:
216
- try:
217
- #format into a json parsable string
218
- TempJsonObject = jsonLines[ 0 : jsonLines.rindex('}') + 1 ]
219
-
220
- #parse json
221
- jsonobject = json.loads(TempJsonObject)
222
-
223
- #checking for first job
224
- if (jobCount == 0):
225
- #getting start time of job
226
- startTime = (jsonobject['timestamp_ms'] - jsonobject['jobs'][0]['read']['runtime'])
227
- comment = str(arguments).replace(",","\n").replace("}","").replace("{","")
228
- jobName = str(jsonobject['jobs'][0]['jobname'])
229
- #adding start annotation
230
- fioCallbacks["TEST_START"](myStream, str(startTime), jobName, comment)
231
-
232
- #pass specific data
233
- readDataValue = jsonobject['jobs'][0]['read']['iops']
234
- writeDataValue = jsonobject['jobs'][0]['write']['iops']
235
- #converted to ditionary - easy script use
236
- dataValues = {"read_iops" : readDataValue, "write_iops" : writeDataValue}
237
- jobEndTime = str(jsonobject['timestamp_ms'])
238
- fioCallbacks["TEST_RESULT"](myStream, jobEndTime, dataValues)
239
-
240
- #jsonLines variable is now all characters after last job + any new that come in
241
- jsonLines = jsonLines[jsonLines.rindex('}') + 1 : ]
242
-
243
- #add 1 to the job count
244
- jobCount += 1
245
-
246
- except:
247
- #exception caused by not being able to find substring -- Last json object --
248
- pass
249
-
250
-
251
-
252
- #looks for end of process and the specific string we return indicating end of file
253
- if p.poll() is not None:
254
- if line == "quarch_end_Process":
255
- time.sleep(0.1)
256
- #callback to end test -- adds 1 milli second so this time is always after the last data point --
257
- fioCallbacks["TEST_END"](myStream, str(int(jobEndTime) + 1))
258
- #CLOSE FILE ON FINISH
259
- logfile.close()
260
- return
261
-
262
- def start_fio(output_file, mode, options, fileName=""):
263
-
264
- if mode == "cli":
265
- command = command + " > pipe"
266
-
267
- #command line to be sent -- output is in json format --
268
- if mode == "file":
269
- command = "fio " + fileName + " --log_unix_epoch=1 --output-format=json --output="+ output_file + " --status-interval=1 --eta=never"
270
-
271
- if mode == "arg":
272
- command = "fio --log_unix_epoch=1 --output-format=json"
273
-
274
- for i in options:
275
- if (options[i] == ""):
276
- command = command + " --" + i
277
- else:
278
- command = command + " --" + i + "=" + options[i]
279
- command = command + " > pipe"
280
-
281
- #removes the output file if it already exists.
282
- if os.path.exists(output_file):
283
- os.remove(output_file)
284
-
285
- if os.path.exists("pipe"):
286
- os.remove("pipe")
287
-
288
- p = subprocess.Popen(command, shell=True)
289
-
290
- while not os.path.exists(output_file):
291
- time.sleep(0.1)
292
-
293
- return p
294
-
295
- def runFIO(myStream, mode, fioCallbacks, user_data, arguments="", file_name=""):
296
-
297
- try:
298
- xrange
299
- except NameError:
300
- xrange = range
301
-
302
- for i in xrange(0,len(arguments)):
303
-
304
- try:
305
- arguments_ori = arguments[i]
306
- except:
307
- arguments_ori = arguments
308
-
309
- output_file = arguments_ori["output"]
310
- if (file_name != ""):
311
- #allows filename with spaces
312
- file_name = "\"" + file_name + "\""
313
-
314
- p = start_fio(output_file, mode, arguments_ori, file_name)
315
-
316
- return_data(output_file, p, fioCallbacks, myStream, user_data, arguments_ori)
317
-
318
- if os.path.exists("pipe"):
319
- os.remove("pipe")
320
-
321
- if isinstance(arguments, dict):
322
- break