Skip to content

Commit 548924d

Browse files
committed
Update python files & pipeline settings
1 parent 3bec78d commit 548924d

File tree

8 files changed

+53
-15
lines changed

8 files changed

+53
-15
lines changed

pygpt/core/profiler.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -76,8 +76,8 @@ def update(self, process):
7676
self.stats['cpu_perc'].append(cpu_perc) # cpu usage
7777
self.stats['cpu_time'].append(cpu_time) # cpu time
7878
self.stats['threads'].append(n_threads) # num threads
79-
except Exception:
80-
print('No access to process...')
79+
except Exception as e:
80+
print(e.args)
8181

8282

8383
def summary(self):
@@ -257,6 +257,7 @@ def __split_command_args__(command):
257257
token += char
258258
if token:
259259
args.append(token)
260+
260261
return args
261262

262263

@@ -332,7 +333,8 @@ def profile(command, sampling_time, output, **kwargs):
332333
env = os.environ
333334
if 'env' in kwargs:
334335
env = kwargs['env']
335-
print(env)
336+
if os.environ.get('CI_PROJECT_DIR') is None:
337+
print(env)
336338
print(command)
337339
proc = subprocess.Popen(command,
338340
stdout=subprocess.PIPE,

pygpt/core/results.py

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
License: GPLv3
66
"""
77
import datetime
8-
import sys
8+
import os
99
import json
1010

1111
import matplotlib as mpl
@@ -61,9 +61,11 @@ def __init__(self, struct, results, adaptor=None):
6161

6262
def __load_perfs__(self):
6363
perf_stats_file = fs.statistics.resolve(self.name+'.json')
64-
with open(perf_stats_file, 'r') as stats:
65-
return json.load(stats)
66-
return None
64+
if os.path.isfile(perf_stats_file):
65+
with open(perf_stats_file, 'r') as stats:
66+
return json.load(stats)
67+
else:
68+
return None
6769

6870
def __load_stdout__(self):
6971
stdout_path = fs.outputs.resolve(f'{self.name}_gptOutput.txt')
@@ -276,7 +278,7 @@ def plots_path(self, version):
276278
plt.ylabel('CPU Average Time (s)')
277279
plt.title('CPU Average Time Historic')
278280
#set ticks every day
279-
axis.xaxis.set_major_locator(mdates.DayLocator())
281+
axis.xaxis.set_major_locator(mdates.DayLocator(interval=5))
280282
#set major ticks format
281283
axis.xaxis.set_major_formatter(mdates.DateFormatter('%Y-%m-%d'))
282284

@@ -292,7 +294,7 @@ def plots_path(self, version):
292294
plt.ylabel('Memory Average (Mb)')
293295
plt.title('Memory Average Historic')
294296
#set ticks every day
295-
axis.xaxis.set_major_locator(mdates.DayLocator())
297+
axis.xaxis.set_major_locator(mdates.DayLocator(interval=5))
296298
#set major ticks format
297299
axis.xaxis.set_major_formatter(mdates.DateFormatter('%Y-%m-%d'))
298300

pygpt/core/tools.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,10 @@ def setter(self, value):
9191
return inner
9292

9393
def split_args(arg):
94+
"""
95+
DEPRECATED since it does not work on CI.
96+
Useless because str.split(" ") does the job
97+
"""
9498
res = []
9599
curr = ''
96100
skip = False
@@ -117,4 +121,4 @@ def split_args(arg):
117121

118122
if len(curr) > 0:
119123
res.append(curr)
120-
return res
124+
return res

pygpt/filter_json.py

Lines changed: 29 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
from core.models import TestScope
1616

1717
__test_files__ = "JSONTestFiles.txt"
18+
__data_files__ = "testData.txt"
1819

1920
# tags
2021
__RELEASE_TAG__ = 'release'
@@ -23,10 +24,11 @@
2324
__REGULAR_TAG__ = 'regular'
2425

2526

26-
def __create_test_json_list__(test_folder, scope, test_files_path):
27+
def __create_test_json_list__(test_folder, scope, test_files_path, data_files_path):
2728
"""cretas files containing list of tests to execute for a given scope"""
2829
test_files = utils.rlist_files(test_folder, lambda f: f.endswith('.json'))
2930
test_list = []
31+
test_data = []
3032
scope = TestScope.init(scope)
3133
for test_path in test_files:
3234
with open(test_path, 'r') as test_file:
@@ -36,9 +38,33 @@ def __create_test_json_list__(test_folder, scope, test_files_path):
3638
if TestScope.compatibleN(scope, test['frequency']):
3739
if test_path not in test_list:
3840
test_list.append(test_path)
41+
if 'inputs' in test:
42+
if 'input' in test['inputs']:
43+
if test['inputs']['input'] not in test_data:
44+
test_data.append(test['inputs']['input'])
45+
if 'input1' in test['inputs']:
46+
if test['inputs']['input1'] not in test_data:
47+
test_data.append(test['inputs']['input1'])
48+
if 'input2' in test['inputs']:
49+
if test['inputs']['input2'] not in test_data:
50+
test_data.append(test['inputs']['input2'])
51+
if 'input3' in test['inputs']:
52+
if test['inputs']['input3'] not in test_data:
53+
test_data.append(test['inputs']['input3'])
54+
if 'input4' in test['inputs']:
55+
if test['inputs']['input4'] not in test_data:
56+
test_data.append(test['inputs']['input4'])
57+
if 'input5' in test['inputs']:
58+
if test['inputs']['input5'] not in test_data:
59+
test_data.append(test['inputs']['input5'])
60+
if 'input6' in test['inputs']:
61+
if test['inputs']['input6'] not in test_data:
62+
test_data.append(test['inputs']['input6'])
3963
# test_list += f'{test_path}\n'
4064
with open(test_files_path, 'w') as file:
4165
file.write('\n'.join(test_list))
66+
with open(data_files_path, 'w') as file:
67+
file.write('\n'.join(test_data))
4268
return True
4369

4470

@@ -73,8 +99,9 @@ def __main__():
7399
log.error("output folder does not exist")
74100
sys.exit(1)
75101
json_test_files = os.path.join(args.output_folder, __test_files__)
102+
data_file = os.path.join(args.output_folder, __data_files__)
76103

77-
if __create_test_json_list__(args.test_folder, args.scope, json_test_files):
104+
if __create_test_json_list__(args.test_folder, args.scope, json_test_files, data_file):
78105
log.success(f"filtered JSON created in {json_test_files}")
79106

80107

pygpt/snap_gpt_test.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -264,7 +264,7 @@ def __check_outputs__(test, args, properties):
264264
cmd += args.java_args.split(" ")
265265
else:
266266
cmd += utils.split_args(args.java_args)
267-
cmd += [args.test_output, output_path, expected_output_path, output['outputName']]
267+
cmd += [args.test_output, os.path.normpath(output_path), os.path.normpath(expected_output_path), output['outputName']]
268268
log.info(cmd)
269269
result = subprocess.run(cmd, stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
270270
log.info(f'comparing done, result: {result.returncode}')

requirements.txt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,5 @@ psutil
22
matplotlib
33
lxml
44
cryptography
5-
pymysql
5+
pymysql == 1.1.*
6+
fs

run_tests.bat

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ FOR /F "usebackq tokens=1,2* delims=" %%t in ("%CI_PROJECT_DIR%\%REPORT_DIR%\JSO
99
:: Run test
1010
echo "Running %%t"
1111
set CI_PROJECT_DIR=%CI_PROJECT_DIR%
12+
set JAVA_HOME=%JAVA_HOME%
1213
echo java args: "%JAVA_OPTIONS% -cp %CLASSPATH%"
1314
echo %USERPROFILE%
1415
python "%CI_PROJECT_DIR%\pygpt\snap_gpt_test.py" java "%JAVA_OPTIONS% -cp %CLASSPATH%" org.esa.snap.test.TestOutput "%CI_PROJECT_DIR%\%PROPERTIES_PATH%" %SCOPE% "%CI_PROJECT_DIR%\%%t" "%CI_PROJECT_DIR%\%REPORT_DIR%\report\output" true

windows.gitlab-ci.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,12 @@ test_windows:
1414
SNAP_INSTALLER: snap_all_windows-9.exe
1515
TEST_DATA_LIST: singleTestData.txt
1616
JAVA_HOME: C:\\Program Files\\Eclipse Adoptium\\jdk-8.0.402.6-hotspot
17+
JDK_HOME: C:\\Program Files\\Eclipse Adoptium\\jdk-8.0.402.6-hotspot
1718
JAVA_OPTIONS: >-
1819
-Dncsa.hdf.hdflib.HDFLibrary.hdflib=%SNAP_DIR%\\snap\\modules\\lib\\amd64\\jhdf.dll
1920
-Dncsa.hdf.hdf5lib.H5.hdf5lib=%SNAP_DIR%\\snap\modules\\lib\amd64\\jhdf5.dll
2021
-Dfile.encoding=Windows-1252
21-
CLASSPATH: gpt-tests-executer\\target\\gpt-test-exec.jar
22+
CLASSPATH: gpt-tests-executer\\target\\TestOutput.jar
2223
# output upload and download progress every 2 seconds
2324
TRANSFER_METER_FREQUENCY: "2s"
2425
# Use fast compression for artifacts, resulting in larger archives

0 commit comments

Comments
 (0)