-
Notifications
You must be signed in to change notification settings - Fork 0
/
main_mem_freeze.py
66 lines (53 loc) · 2.67 KB
/
main_mem_freeze.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
from collections import defaultdict
from datetime import datetime
import requests
import re
import urllib.request
import json
import time
import csv
import paramiko
import sys
import threading
from multiprocessing import Event, Process
from multiprocessing.pool import ThreadPool
import subprocess
import os
import signal
from functional_methods import *
from collect_data import *
from variables import *
# INSTANCE = ""
# TARGET_VIDEO = ""
# DETECTION_IMAGE = ""
# CALCULATING_HOSTNAME = SERVER_USER
# CALCULATING_INSTANCE = SERVER_IP
# POD_EXISTED = 0
# CALCULATION_TYPE = ""
# finished = False
timestamps = {}
# terminate_state = defaultdict(list)
def collect_life_cycle(target_pods: int, repetition: int):
#NOTE: Null process
timestamps["warm_state_start"]=time.time()
collect_state(target_pods, repetition, WARM_MEM_STATE)
timestamps["warm_state_end"]=time.time()
print("Measurement finished.")
print("Saving timestamps..")
timestamps_to_file(timestamps, target_pods, repetition)
# event.set()
print("Finished!")
if __name__ == "__main__":
target_pods_scale = sys.argv[1] # number of scaling pod
repeat_time = sys.argv[2]
INSTANCE = sys.argv[3] # jetson
# this P0 process runs infintely, detect and manual terminate "terminating" pods
# event = Event() # the event is unset when created
# p0 = Process(target=auto_delete, args=(event, ))
# p0.start()
collect_life_cycle(int(target_pods_scale), int(repeat_time))
# p1 = Process(target=collect_life_cycle, args=(event, int(target_pods_scale), repeat_time, ), daemon = True)
# print("Start calculate job on {}".format(INSTANCE))
# p1.start()
# p0.join()
# p1.join()