Commit 3276986d authored by JOSSOUD Olivier's avatar JOSSOUD Olivier
Browse files

SFTP DMC. New directory structure on Hermes

parent a1bf0a8c
Pipeline #159759 failed with stage
in 38 seconds
......@@ -30,18 +30,14 @@ class PicarroCollector(utils.LogConfig):
# Build source file path
picarro_number = re.sub("[^0-9]", "", picarro_id)
source_filepath = self.distant_base_dir + "/" + picarro_number + "/DMC_" + picarro_id + "_" + date_str + ".zip"
source_filepath = self.distant_base_dir + "/picarro/DMC_" + picarro_id + "_" + date_str + ".lzma"
# Build destination file path
dest_filepath = utils.get_standard_filepath(self.local_base_dir, "DMC", "picarro", picarro_id, date_str, "zip")
dest_filepath = utils.get_standard_filepath(self.local_base_dir, "DMC", "picarro", picarro_id, date_str, "lzma")
# Download file
sftp_client = sftp.connect(self.config[self.object_id], self.logger)
success = sftp.download_file(sftp_client, source_filepath, dest_filepath, self.logger)
sftp_client.close()
# Re-compress, from ZIP to LZMA
if success:
utils.recompress_file(dest_filepath, self.logger)
return True
......@@ -7,4 +7,4 @@ import wimcollect.sftpdmc as sftpdmc
class TestPicarroCollector(TestCase):
def test_download(self):
collector = sftpdmc.PicarroCollector()
self.assertTrue(collector.download("HIDS2319", datetime.date(2020, 1, 11)))
\ No newline at end of file
self.assertTrue(collector.download("HIDS2308", datetime.date(2021, 12, 8)))
\ No newline at end of file
Markdown is supported
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