File tree Expand file tree Collapse file tree 3 files changed +17
-8
lines changed
frontend/server/src/main/java/com/amazonaws/ml/mms/metrics Expand file tree Collapse file tree 3 files changed +17
-8
lines changed Original file line number Diff line number Diff line change @@ -15,7 +15,8 @@ phases:
1515 - pip install twine
1616 - pip install pytest-mock -U
1717 - pip install requests
18- - pip install -U -e .[mxnet]
18+ - pip install -U -e .
19+ - pip install mxnet==1.5.0
1920 - cd model-archiver/ && pip install -U -e . && cd ../
2021
2122 build :
Original file line number Diff line number Diff line change @@ -117,10 +117,14 @@ public void run() {
117117 if (tokens .length != 2 ) {
118118 continue ;
119119 }
120-
121- Integer pid = Integer .valueOf (tokens [0 ]);
122- WorkerThread worker = workerMap .get (pid );
123- worker .setMemory (Long .parseLong (tokens [1 ]));
120+ try {
121+ Integer pid = Integer .valueOf (tokens [0 ]);
122+ WorkerThread worker = workerMap .get (pid );
123+ worker .setMemory (Long .parseLong (tokens [1 ]));
124+ } catch (NumberFormatException e ) {
125+ logger .warn ("Failed to parse memory utilization metrics: " + line );
126+ continue ;
127+ }
124128 }
125129 }
126130 } catch (IOException e ) {
Original file line number Diff line number Diff line change 1717
1818import psutil
1919
20-
2120def get_cpu_usage (pid ):
2221 """
2322 use psutil for cpu memory
@@ -27,10 +26,13 @@ def get_cpu_usage(pid):
2726 try :
2827 process = psutil .Process (int (pid ))
2928 except psutil .Error :
30- logging .error ("Failed get process for pid: %s" , pid , exc_info = True )
29+ logging .error ("Failed to get process for pid: %s" , pid , exc_info = True )
3130 return 0
3231
3332 mem_utilization = process .memory_info ()[0 ]
33+ if mem_utilization == 0 :
34+ logging .error ("Failed to get memory utilization for pid: %s" , pid , exc_info = True )
35+ return 0
3436 return mem_utilization
3537
3638
@@ -45,4 +47,6 @@ def check_process_mem_usage(stdin):
4547 for process in process_list :
4648 if not process :
4749 continue
48- logging .info ("%s:%d" , process , get_cpu_usage (process ))
50+ mem_utilization = get_cpu_usage (process )
51+ if mem_utilization != 0 :
52+ logging .info ("%s:%d" , process , mem_utilization )
You can’t perform that action at this time.
0 commit comments