forked from mhulsman/cluster_tools
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgcp
executable file
·27 lines (23 loc) · 799 Bytes
/
gcp
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
#!/usr/bin/env python
import cluster_storage
import sys
import os
source = sys.argv[1]
destination = sys.argv[2]
cs = cluster_storage.ClusterStorageEngine()
if source.startswith('grid:/'):
source = source[6:]
if not source.startswith('/'):
source = os.path.join(os.environ['LFC_HOME'], source)
cs.retrieve_file(source,destination)
elif destination.startswith('grid:/'):
destination = destination[6:]
if not destination.startswith('/'):
destination = os.path.join(os.environ['LFC_HOME'], destination)
cs.store_file(source,destination)
elif source.startswith('/grid/'):
cs.retrieve_file(source,destination)
elif destination.startswith('/grid/'):
cs.store_file(source,destination)
else:
print "Grid path should start with grid:/"