Skip to content

Commit 005ab44

Browse files
authored
Merge pull request #183 from lanl/issue180
updated file movement
2 parents 85c706c + e0fe920 commit 005ab44

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
@@ -1585,6 +1585,8 @@ def copy(self, tool="copy", isVerbose=False, **kwargs):
15851585
remote_host = "myremote"
15861586
elif tool == "conduit":
15871587
# Data movement via Conduit
1588+
env = os.environ.copy()
1589+
15881590
if not os.path.exists(self.remote_location):
15891591
if isVerbose:
15901592
print( " mkdir " + self.remote_location)
@@ -1609,7 +1611,31 @@ def copy(self, tool="copy", isVerbose=False, **kwargs):
16091611
# if isVerbose:
16101612
# print( "conduit cp " + file + " " + file_remote)
16111613
try:
1612-
subprocess.run(["conduit", "cp", "-r", self.local_location, self.remote_location], shell=True)
1614+
#subprocess.call(["conduit", "cp", "-r", self.local_location, self.remote_location], env=env, shell=True)
1615+
1616+
# File Movement
1617+
if isVerbose:
1618+
print( "conduit cp -r " + os.path.join(self.local_location, self.project_name) + " " + os.path.join(self.remote_location, self.project_name) )
1619+
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)]
1620+
process = subprocess.Popen(cmd, stdin=subprocess.DEVNULL, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True, encoding='latin-1')
1621+
1622+
stdout, stderr = process.communicate()
1623+
returncode = process.communicate()
1624+
1625+
print( " DSI submitted Conduit job. ")
1626+
1627+
# Database Movement
1628+
if isVerbose:
1629+
print( " conduit cp " + str(self.project_name+".db") + " " + os.path.join(self.remote_location, self.project_name, self.project_name+".db" ) )
1630+
1631+
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" )]
1632+
process = subprocess.Popen(cmd, stdin=subprocess.DEVNULL, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True, encoding='latin-1')
1633+
1634+
stdout, stderr = process.communicate()
1635+
returncode = process.communicate()
1636+
1637+
print( " DSI submitted Conduit job. ")
1638+
16131639
except subprocess.CalledProcessError as e:
16141640
print(f"Command failed with error: {e.stderr} ")
16151641

@@ -1621,6 +1647,8 @@ def copy(self, tool="copy", isVerbose=False, **kwargs):
16211647
else:
16221648
raise TypeError(f"Data movement format not supported:, Type: {tool}")
16231649

1650+
1651+
16241652

16251653
def dircrawl(self,filepath):
16261654
"""

0 commit comments

Comments
 (0)