Commits

Ville Suoranta authored 7790f3a119b
Replace distutils remove_tree with shutil shutil.copytree
No tags

casatasks/src/private/task_uvcontsub_old.py

Modified
1 1 import os
2 2 import re
3 3 import shutil
4 4 import time
5 5 import tempfile
6 6 import numpy as np
7 7
8 -# shutil.copytree is useless with directories created by tempfile
9 -# (or any directories that already exist).
10 -from distutils.dir_util import copy_tree
11 -
12 8 from casatools import calibrater, ms, table
13 9 from casatasks import casalog, virtualconcat
14 10
15 11 from .mstools import write_history
16 12 from .update_spw import *
17 13 from .parallel.parallel_data_helper import ParallelDataHelper
18 14 from .parallel.parallel_task_helper import ParallelTaskHelper
19 15
20 16 mytb = table( )
21 17 mycb = calibrater( )
209 205 split_result = myms.split(csvis, spw=tempspw, field=myfield, whichcol=whichcol)
210 206 myms.close()
211 207 # jagonzal (CAS-4113): Take care of the trivial parallelization
212 208 if not split_result:
213 209 msg = "MSSelectionNullSelection: %s does not have data for spw=%s, field=%s, bailing out!" % (vis,tempspw,field)
214 210 shutil.rmtree(csvis)
215 211 raise RuntimeError(msg)
216 212 else:
217 213 # This takes almost 30s/GB. (lustre, 8/2011)
218 214 casalog.post('Copying ' + vis + ' to ' + csvis + ' with cp.')
219 - copy_tree(vis, csvis, preserve_symlinks=True)
215 + shutil.copytree(vis, csvis, symlinks=True, dirs_exist_ok=True)
220 216
221 217 # It is less confusing if we write the history now that the "root" MS
222 218 # is made, but before cb adds its messages.
223 219 #
224 220 param_names = uvcontsub_old.__code__.co_varnames[:uvcontsub_old.__code__.co_argcount]
225 221 local_vars = locals( )
226 222 param_vals = [local_vars[p] for p in param_names]
227 223
228 224 write_history(myms, csvis, 'uvcontsub_old', param_names, param_vals,
229 225 casalog)

Everything looks good. We'll let you know here if there's anything you should know about.

Add shortcut