Skip to content

Commit

Permalink
Testing...
Browse files Browse the repository at this point in the history
  • Loading branch information
chrisburr committed Mar 26, 2021
1 parent dca3477 commit f3b6855
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -870,7 +870,7 @@ def exists(self, lfns, connection=False):
# either {lfn : guid}
# or P lfn : {PFN : .., GUID : ..} }
if isinstance(lfns, dict):
val = lfns.values()
val = list(lfns.values())

# We have values, take the first to identify the type
if val:
Expand All @@ -881,7 +881,7 @@ def exists(self, lfns, connection=False):
guidList = [lfns[lfn]['GUID'] for lfn in lfns]
elif isinstance(val, six.string_types):
# We hope that it is the GUID which is given
guidList = lfns.values()
guidList = list(lfns.values())

if guidList:
# A dict { guid: lfn to which it is supposed to be associated }
Expand Down
12 changes: 8 additions & 4 deletions src/DIRAC/WorkloadManagementSystem/DB/JobDB.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,16 +46,20 @@

def compressJDL(jdl):
"""Return compressed JDL string."""
return zlib.compress(jdl, -1).encode('base64')
return base64.b64encode(zlib.compress(jdl.encode(), -1)).decode()


def extractJDL(compressedJDL):
"""Return decompressed JDL string."""
# the starting bracket is guaranteeed by JobManager.submitJob
# we need the check to be backward compatible
if compressedJDL.startswith('['):
return compressedJDL
return zlib.decompress(compressedJDL.decode('base64'))
if isinstance(compressedJDL, bytes):
if compressedJDL.startswith(b'['):
return compressedJDL.decode()
else:
if compressedJDL.startswith('['):
return compressedJDL
return zlib.decompress(base64.b64decode(compressedJDL)).decode()


#############################################################################
Expand Down
4 changes: 2 additions & 2 deletions tests/Integration/Core/Test_ElasticsearchDB.py
Original file line number Diff line number Diff line change
Expand Up @@ -182,9 +182,9 @@ def test_getDocTypes(self):
result = self.elasticSearchDB.getDocTypes(self.index_name)
self.assertTrue(result)
if '_doc' in result['Value']:
self.assertEqual(list(result['Value']['_doc']['properties']), [u'Color', u'timestamp', u'Product', u'quantity'])
self.assertEqual(set(result['Value']['_doc']['properties']), {u'Color', u'timestamp', u'Product', u'quantity'})
else:
self.assertEqual(list(result['Value']['properties']), [u'Color', u'timestamp', u'Product', u'quantity'])
self.assertEqual(set(result['Value']['properties']), {u'Color', u'timestamp', u'Product', u'quantity'})

def test_existingIndex(self):
result = self.elasticSearchDB.existingIndex(self.index_name)
Expand Down

0 comments on commit f3b6855

Please sign in to comment.