forked from masudulhasan/Bottleneck-Dectection
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbackground_file_transfer.py
47 lines (36 loc) · 1.13 KB
/
background_file_transfer.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
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Thu Aug 22 00:32:55 2019
@author: masudulhasanmasudb
"""
import threading
import time
from subprocess import PIPE, Popen
exitFlag = 0
# out_file = open("time_stat_for_2_process", "a+")
class myThread(threading.Thread):
def __init__(self, threadID, name, counter):
threading.Thread.__init__(self)
self.threadID = threadID
self.name = name
self.counter = counter
def run(self):
print("\nStarting " + self.name)
run_command(self.threadID, self.counter)
print("\nExiting " + self.name)
def run_command(index, delay):
comm_ss = ['globus-url-copy','-vb','file:///oasis-dm.sdsc.xsede.org:2811//oasis/projects/nsf/sub102/masud/file_directory/another_tmp_file',
'gsiftp://gridftp.bridges.psc.edu:2811/pylon5/ci560np/masud/tmp_file_'+index]
proc = subprocess.Popen(comm_ss, stdout=subprocess.PIPE)
proc.communicate()
counter = 5
i = 1
first_start_time = time.time()
jobs = []
for x in range(1):
thread1 = myThread(i, x, 10)
thread1.start()
jobs.append(thread1)
for t in jobs:
t.join()