Commit 8d1e82353865ca5d347fc59b6fdb4e970c68f2fe

Authored by Jürgen Knödlseder
1 parent 0746e919

Update .gitignore file

.gitignore
... ... @@ -74,7 +74,7 @@ test/pfiles/
74 74 test/caldb/
75 75 test/prod3
76 76 test/csroot2caldb_*
77   -test/iactdata_*
  77 +test/csiactcopy_*
78 78 test/*.fits
79 79 test/*.dat
80 80 test/*.xml
... ...
test/test_csiactcopy.py
... ... @@ -44,9 +44,9 @@ class Test(test):
44 44 test.__init__(self)
45 45  
46 46 # Set data members
47   - self._remote = self._datadir + '/iactdata/master.json'
48   - self._runlist1 = self._datadir + '/iact_runlist_1.dat'
49   - self._runlist2 = self._datadir + '/iact_runlist_2.dat'
  47 + self._remote = self._datadir + '/iactdata/master.json'
  48 + self._runlist1 = self._datadir + '/iact_runlist_1.dat'
  49 + self._runlist2 = self._datadir + '/iact_runlist_2.dat'
50 50  
51 51 # Return
52 52 return
... ... @@ -77,7 +77,7 @@ class Test(test):
77 77 # Setup csiactcopy command
78 78 cmd = csiactcopy+' remote_master="'+self._remote+'"'+ \
79 79 ' prodname="unit-test"'+ \
80   - ' outpath="iactdata_cmd1"'+ \
  80 + ' outpath="csiactcopy_cmd1"'+ \
81 81 ' logfile="csiactcopy_cmd1.log" chatter=1'
82 82  
83 83 # Check if execution of wrong command fails
... ... @@ -89,12 +89,12 @@ class Test(test):
89 89 'Check successful execution from command line')
90 90  
91 91 # Check copy
92   - self._check_copy('iactdata_cmd1')
  92 + self._check_copy('csiactcopy_cmd1')
93 93  
94 94 # Setup csiactcopy command
95 95 cmd = csiactcopy+' remote_master="master_that_does_not_exist"'+ \
96 96 ' prodname="unit-test"'+ \
97   - ' outpath="iactdata_test"'+ \
  97 + ' outpath="csiactcopy_cmd2"'+ \
98 98 ' logfile="csiactcopy_cmd2.log"'
99 99  
100 100 # Check if execution failed
... ... @@ -113,9 +113,9 @@ class Test(test):
113 113 iactcopy = cscripts.csiactcopy()
114 114 iactcopy['remote_master'] = self._remote
115 115 iactcopy['prodname'] = 'unit-test'
116   - iactcopy['outpath'] = 'iactdata_py1'
  116 + iactcopy['outpath'] = 'csiactcopy_py1'
117 117 iactcopy['logfile'] = 'csiactcopy_py1.log'
118   - iactcopy['chatter'] = 4
  118 + iactcopy['chatter'] = 2
119 119  
120 120 # Run csiactcopy script and save run list
121 121 iactcopy.logFileOpen() # Make sure we get a log file
... ... @@ -123,32 +123,34 @@ class Test(test):
123 123 iactcopy.save()
124 124  
125 125 # Check IACT data store
126   - self._check_copy('iactdata_py1')
127   - self._check_n_obs('iactdata_py1', 9)
  126 + self._check_copy('csiactcopy_py1')
  127 + self._check_n_obs('csiactcopy_py1', 9)
128 128  
129   - # Set-up csiactcopy
  129 + # Set-up csiactcopy with clobber=True, should lead to skipping
  130 + # of files
130 131 iactcopy = cscripts.csiactcopy()
131 132 iactcopy['remote_master'] = self._remote
132 133 iactcopy['prodname'] = 'unit-test'
133   - iactcopy['outpath'] = 'iactdata_py1'
  134 + iactcopy['outpath'] = 'csiactcopy_py1'
134 135 iactcopy['logfile'] = 'csiactcopy_py2.log'
135   - iactcopy['chatter'] = 4
  136 + iactcopy['chatter'] = 3
136 137 iactcopy['clobber'] = True
137 138  
138   - # Run csiactcopy script and save run list
  139 + # Execute csiactcopy script
139 140 iactcopy.logFileOpen() # Make sure we get a log file
140   - iactcopy.run()
141   - iactcopy.save()
  141 + iactcopy.execute()
142 142  
143 143 # Check copy
144   - self._check_copy('iactdata_py1')
145   - self._check_n_obs('iactdata_py1', 9)
  144 + self._check_copy('csiactcopy_py1')
  145 + self._check_n_obs('csiactcopy_py1', 9)
146 146  
147   - # Set-up csiactcopy
  147 + # Set-up csiactcopy with clobber=False, should also lead to skipping
  148 + # of files, but for the reason that it's not allowed to overwrite
  149 + # the file
148 150 iactcopy = cscripts.csiactcopy()
149 151 iactcopy['remote_master'] = self._remote
150 152 iactcopy['prodname'] = 'unit-test'
151   - iactcopy['outpath'] = 'iactdata_py1'
  153 + iactcopy['outpath'] = 'csiactcopy_py1'
152 154 iactcopy['logfile'] = 'csiactcopy_py3.log'
153 155 iactcopy['chatter'] = 4
154 156 iactcopy['clobber'] = False
... ... @@ -159,21 +161,21 @@ class Test(test):
159 161 iactcopy.save()
160 162  
161 163 # Check copy
162   - self._check_copy('iactdata_py1')
163   - self._check_n_obs('iactdata_py1', 9)
  164 + self._check_copy('csiactcopy_py1')
  165 + self._check_n_obs('csiactcopy_py1', 9)
164 166  
165 167 # Remove the copied IACT data store before continuing
166   - if os.path.isdir('iactdata_py2'):
167   - os.system('rm -r iactdata_py2')
  168 + if os.path.isdir('csiactcopy_py2'):
  169 + os.system('rm -r csiactcopy_py2')
168 170  
169   - # Set-up csiactcopy
  171 + # Set-up csiactcopy using a run list with 5 runs
170 172 iactcopy = cscripts.csiactcopy()
171 173 iactcopy['runlist'] = self._runlist1
172 174 iactcopy['remote_master'] = self._remote
173 175 iactcopy['prodname'] = 'unit-test'
174   - iactcopy['outpath'] = 'iactdata_py2'
  176 + iactcopy['outpath'] = 'csiactcopy_py2'
175 177 iactcopy['logfile'] = 'csiactcopy_py4.log'
176   - iactcopy['chatter'] = 3
  178 + iactcopy['chatter'] = 4
177 179  
178 180 # Run csiactcopy script and save run list
179 181 iactcopy.logFileOpen() # Make sure we get a log file
... ... @@ -181,17 +183,18 @@ class Test(test):
181 183 iactcopy.save()
182 184  
183 185 # Check copy
184   - self._check_copy('iactdata_py2')
185   - self._check_n_obs('iactdata_py2', 5)
  186 + self._check_copy('csiactcopy_py2')
  187 + self._check_n_obs('csiactcopy_py2', 5)
186 188  
187   - # Set-up csiactcopy
  189 + # Set-up csiactcopy using another run list with 4 runs. Should have
  190 + # 9 runs in total in the data store afterwards
188 191 iactcopy = cscripts.csiactcopy()
189 192 iactcopy['runlist'] = self._runlist2
190 193 iactcopy['remote_master'] = self._remote
191 194 iactcopy['prodname'] = 'unit-test'
192   - iactcopy['outpath'] = 'iactdata_py2'
  195 + iactcopy['outpath'] = 'csiactcopy_py2'
193 196 iactcopy['logfile'] = 'csiactcopy_py5.log'
194   - iactcopy['chatter'] = 3
  197 + iactcopy['chatter'] = 4
195 198  
196 199 # Run csiactcopy script and save run list
197 200 iactcopy.logFileOpen() # Make sure we get a log file
... ... @@ -199,17 +202,19 @@ class Test(test):
199 202 iactcopy.save()
200 203  
201 204 # Check copy
202   - self._check_copy('iactdata_py2')
203   - self._check_n_obs('iactdata_py2', 9)
  205 + self._check_copy('csiactcopy_py2')
  206 + self._check_n_obs('csiactcopy_py2', 9)
204 207  
205   - # Set-up csiactcopy
  208 + # Set-up csiactcopy using the same run list with 4 runs again, should
  209 + # lead to skipping of files, and we should still have 9 runs at the
  210 + # end in the datastore.
206 211 iactcopy = cscripts.csiactcopy()
207 212 iactcopy['runlist'] = self._runlist2
208 213 iactcopy['remote_master'] = self._remote
209 214 iactcopy['prodname'] = 'unit-test'
210   - iactcopy['outpath'] = 'iactdata_py2'
  215 + iactcopy['outpath'] = 'csiactcopy_py2'
211 216 iactcopy['logfile'] = 'csiactcopy_py6.log'
212   - iactcopy['chatter'] = 3
  217 + iactcopy['chatter'] = 4
213 218 iactcopy['clobber'] = True
214 219  
215 220 # Run csiactcopy script and save run list
... ... @@ -218,8 +223,8 @@ class Test(test):
218 223 iactcopy.save()
219 224  
220 225 # Check copy
221   - self._check_copy('iactdata_py2')
222   - self._check_n_obs('iactdata_py2',9)
  226 + self._check_copy('csiactcopy_py2')
  227 + self._check_n_obs('csiactcopy_py2',9)
223 228  
224 229 # Return
225 230 return
... ... @@ -266,7 +271,7 @@ class Test(test):
266 271 pathname : str
267 272 Path to copied IACT data store
268 273 n_expected : int
269   - Expected number of observation in IACT data store
  274 + Expected number of observations in IACT data store
270 275 """
271 276 # Set file name
272 277 obs_index_name = gammalib.GFilename(pathname+'/obs-index.fits[OBS_INDEX]')
... ...