Skip to content

Commit e0fe920

Browse files
author
Jesus Pulido
committed
updated file movement
1 parent f2641b0 commit e0fe920

File tree

1 file changed

+29
-1
lines changed

1 file changed

+29
-1
lines changed

dsi/core.py

Lines changed: 29 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1568,6 +1568,8 @@ def copy(self, tool="copy", isVerbose=False, **kwargs):
15681568
remote_host = "myremote"
15691569
elif tool == "conduit":
15701570
# Data movement via Conduit
1571+
env = os.environ.copy()
1572+
15711573
if not os.path.exists(self.remote_location):
15721574
if isVerbose:
15731575
print( " mkdir " + self.remote_location)
@@ -1592,7 +1594,31 @@ def copy(self, tool="copy", isVerbose=False, **kwargs):
15921594
# if isVerbose:
15931595
# print( "conduit cp " + file + " " + file_remote)
15941596
try:
1595-
subprocess.run(["conduit", "cp", "-r", self.local_location, self.remote_location], shell=True)
1597+
#subprocess.call(["conduit", "cp", "-r", self.local_location, self.remote_location], env=env, shell=True)
1598+
1599+
# File Movement
1600+
if isVerbose:
1601+
print( "conduit cp -r " + os.path.join(self.local_location, self.project_name) + " " + os.path.join(self.remote_location, self.project_name) )
1602+
cmd = ['/usr/projects/systems/conduit/bin/conduit-cmd','--config','/usr/projects/systems/conduit/conf/conduit-cmd-config.yaml','cp','-r',os.path.join(self.local_location, self.project_name), os.path.join(self.remote_location, self.project_name)]
1603+
process = subprocess.Popen(cmd, stdin=subprocess.DEVNULL, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True, encoding='latin-1')
1604+
1605+
stdout, stderr = process.communicate()
1606+
returncode = process.communicate()
1607+
1608+
print( " DSI submitted Conduit job. ")
1609+
1610+
# Database Movement
1611+
if isVerbose:
1612+
print( " conduit cp " + str(self.project_name+".db") + " " + os.path.join(self.remote_location, self.project_name, self.project_name+".db" ) )
1613+
1614+
cmd = ['/usr/projects/systems/conduit/bin/conduit-cmd','--config','/usr/projects/systems/conduit/conf/conduit-cmd-config.yaml','cp','-r', str(self.project_name+".db"), os.path.join(self.remote_location, self.project_name, self.project_name+".db" )]
1615+
process = subprocess.Popen(cmd, stdin=subprocess.DEVNULL, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True, encoding='latin-1')
1616+
1617+
stdout, stderr = process.communicate()
1618+
returncode = process.communicate()
1619+
1620+
print( " DSI submitted Conduit job. ")
1621+
15961622
except subprocess.CalledProcessError as e:
15971623
print(f"Command failed with error: {e.stderr} ")
15981624

@@ -1604,6 +1630,8 @@ def copy(self, tool="copy", isVerbose=False, **kwargs):
16041630
else:
16051631
raise TypeError(f"Data movement format not supported:, Type: {tool}")
16061632

1633+
1634+
16071635

16081636

16091637
def dircrawl(self,filepath):

0 commit comments

Comments
 (0)