Commit 2d6080e4 authored by Maria Arsuaga Rios's avatar Maria Arsuaga Rios
Browse files

When none checksum is explicit no verification is done

parent 9c1bcbef
......@@ -176,20 +176,21 @@ class JobSubmitter(Base):
return [{"sources": [self.source], "destinations": [self.destination]}]
def _do_submit(self, context):
checksum_mode = 'none'
#Backwards compatibility: compare_checksum parameter
if self.options.compare_checksum:
checksum_mode = 'both'
else:
if self.checksum:
checksum_mode = 'target'
checksum_mode = 'target'
else:
checksum = 'none'
#Compare checksum has major priority than checksum_mode
if not self.options.compare_checksum:
if len(self.options.checksum_mode) > 0:
checksum_mode = self.options.checksum_mode
#Backwards compatibility: target checksum when checksum is provided and not verify option
if self.checksum and checksum_mode=='none':
checksum_mode = 'target'
checksum_mode = self.options.checksum_mode
else:
checksum_mode = 'none'
if not self.checksum:
self.checksum = DEFAULT_CHECKSUM
......@@ -244,20 +245,21 @@ class JobSubmitter(Base):
return job_id
def _do_dry_run(self, context):
checksum_mode = 'none'
#Backwards compatibility: compare_checksum parameter
if self.options.compare_checksum:
checksum_mode = 'both'
else:
if self.checksum:
checksum_mode = 'target'
checksum_mode = 'target'
else:
checksum = 'none'
#Compare checksum has major priority than checksum_mode
if not self.options.compare_checksum:
if len(self.options.checksum_mode) > 0:
checksum_mode = self.options.checksum_mode
#Backwards compatibility: target checksum when checksum is provided and not verify option
if self.checksum and checksum_mode=='none':
checksum_mode = 'target'
checksum_mode = self.options.checksum_mode
else:
checksum_mode = 'none'
if not self.checksum:
self.checksum = DEFAULT_CHECKSUM
......@@ -266,7 +268,7 @@ class JobSubmitter(Base):
self._build_transfers(),
checksum=self.checksum,
bring_online=self.options.bring_online,
verify_checksum=checksum_mode[0],
verify_checksum=checksum_mode,
spacetoken=self.options.destination_token,
source_spacetoken=self.options.source_token,
fail_nearline=self.options.fail_nearline,
......
......@@ -99,7 +99,7 @@ def add_alternative_source(transfer, alt_source):
return transfer
def new_job(transfers=None, deletion=None, verify_checksum='target', reuse=False, overwrite=False, multihop=False,
def new_job(transfers=None, deletion=None, verify_checksum=False, reuse=False, overwrite=False, multihop=False,
source_spacetoken=None, spacetoken=None,
bring_online=None, copy_pin_lifetime=None,
retry=-1, retry_delay=0, metadata=None, priority=None, strict_copy=False,
......@@ -134,13 +134,7 @@ def new_job(transfers=None, deletion=None, verify_checksum='target', reuse=False
if transfers is None:
transfers = []
if isinstance(verify_checksum, bool):
if verify_checksum:
verify_checksum = 'both'
else:
verify_checksum = 'none'
else:
if isinstance(verify_checksum, basestring):
if isinstance(verify_checksum, basestring):
if not verify_checksum in ('source','target','both', 'none'):
raise ClientError('Bad request: verify_checksum does not contain a valid value')
params = dict(
......
......@@ -42,7 +42,7 @@ MAX_SIZE_SMALL_FILE = 104857600 #100MB
DEFAULT_PARAMS = {
'bring_online': -1,
'verify_checksum': 'none',
'verify_checksum': False,
'copy_pin_lifetime': -1,
'gridftp': '',
'job_metadata': None,
......@@ -469,12 +469,9 @@ class JobBuilder(object):
for file_dict in self.files:
if file_dict['checksum'] is not None:
has_checksum = len(file_dict['checksum']) > 0
break
if file_dict['checksum'] is None:
file_dict['checksum'] = 'ADLER32'
for file_dict in self.files:
if file_dict['checksum'] is None:
else:
file_dict['checksum'] = 'ADLER32'
if type(self.job['checksum_method']) == bool:
if not self.job['checksum_method'] and has_checksum:
self.job['checksum_method'] = 'target'
......@@ -484,7 +481,7 @@ class JobBuilder(object):
else:
self.job['checksum_method'] = 'both'
self.job['checksum_method']=self.job['checksum_method'][0]
self.job['checksum_method'] = self.job['checksum_method'][0]
# Validate that if this is a multiple replica job, that there is one single unique file
self.is_multiple, unique_files = _has_multiple_options(self.files)
if self.is_multiple:
......@@ -556,7 +553,7 @@ class JobBuilder(object):
overwrite_flag='N',
source_space_token=self.params['source_spacetoken'],
copy_pin_lifetime=-1,
checksum_method='n',
checksum_method=None,
bring_online=None,
job_metadata=self.params['job_metadata'],
internal_job_params=None,
......
......@@ -422,7 +422,7 @@ class TestJobSubmission(TestController):
job = Session.query(Job).get(job_id)
self.assertEqual(job.files[0].checksum, '1234F')
self.assertEqual(job.verify_checksum, 'r')
self.assertEqual(job.verify_checksum, 't')
return job_id
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment