-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathmove_data.py
45 lines (40 loc) · 1.82 KB
/
move_data.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
import argparse
from datetime import datetime
from jax_omeroutils.datamover import DataMover
from pathlib import Path
def main(import_batch_directory, fileset_list,
xml_path, log_directory, timestamp):
# Move files into place
if Path(import_batch_directory / 'import.json').exists():
mover = DataMover(import_batch_directory / 'import.json', fileset_list,
xml_path)
mover.set_logging(log_directory, timestamp)
message = mover.move_data()
print(message)
return
if __name__ == "__main__":
description = 'Move data to server ahead of OMERO import'
parser = argparse.ArgumentParser(description=description)
parser.add_argument('import_batch_directory',
type=str,
help='Full path of directory containing images to'
' import and single metadata file')
parser.add_argument('fileset_list',
type=str,
help='Text file with list of files that need'
' to be transfered')
parser.add_argument('xml_path',
type=str,
help='path to a valid transfer.xml to be used with '
'omero transfer unpack')
parser.add_argument('log_directory',
type=str,
help='Directory for the log files')
parser.add_argument('--timestamp',
type=str,
required=False,
default=datetime.now().strftime('%Y%m%d_%H%M%S'),
help='Timestamp for the log files')
args = parser.parse_args()
main(Path(args.import_batch_directory), Path(args.fileset_list),
Path(args.xml_path), Path(args.log_directory), args.timestamp)