Skip to content

Commit bda3610

Browse files
committed
clean code after payload url change
1 parent 5d12a21 commit bda3610

File tree

14 files changed

+44
-44
lines changed

14 files changed

+44
-44
lines changed

glouton/commands/download/payloadDownloadCommand.py renamed to glouton/commands/download/archiveDownloadCommand.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
import requests
77

88

9-
class PayloadDownloadCommand(DownloadObservationCommand):
9+
class ArchiveDownloadCommand(DownloadObservationCommand):
1010
def __init__(self, params, observation, modules_commands):
1111
DownloadObservationCommand.__init__(self, params, observation, modules_commands)
1212
self.__json_id = "archive_url"
@@ -26,7 +26,7 @@ def download(self):
2626

2727
r = self.client.get(url)
2828
if r.status_code == 200:
29-
logger.Info('downloading...' + file_name)
29+
logger.Info('downloading archive...' + file_name)
3030
with open(full_path_file, "wb") as file:
3131
file.write(r.content)
3232
self.runModulesAfterDownload(file_name)

glouton/config.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
"HTTP_PROXY": ""
88
},
99
"MODULES": {
10-
"PAYLOAD": [],
10+
"ARCHIVE": [],
1111
"WATERFALL": [],
1212
"DEMODDATA": [],
1313
"FRAME": [],
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
class Payload:
1+
class Archive:
22
def __init__(self, url=None):
33
self.url = url
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
class Observation:
2-
def __init__(self, id=None, start_date=None, waterfall=None, payload=None):
2+
def __init__(self, id=None, start_date=None, waterfall=None, archive=None):
33
self.id = id
44
self.start_date = start_date
55
self.waterfall = waterfall
6-
self.payload = payload
6+
self.archive = archive

glouton/domain/parameters/programCmd.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,10 @@ def __init__(self,
66
end_date,
77
observation_status,
88
working_dir,
9-
payloads,
9+
archives,
1010
waterfalls,
1111
demoddata,
12-
payload_modules,
12+
archive_modules,
1313
demoddata_modules,
1414
waterfall_modules,
1515
user,
@@ -25,10 +25,10 @@ def __init__(self,
2525
self.start_date = start_date
2626
self.end_date = end_date
2727
self.working_dir = working_dir
28-
self.payloads = payloads
28+
self.archives = archives
2929
self.waterfalls = waterfalls
3030
self.demoddata = demoddata
31-
self.payload_modules = payload_modules
31+
self.archive_modules = archive_modules
3232
self.demoddata_modules = demoddata_modules
3333
self.waterfall_modules = waterfall_modules
3434
self.observation_status = observation_status

glouton/repositories/payload/payloadRepo.py renamed to glouton/repositories/archive/archiveRepo.py

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,37 +1,37 @@
11
from queue import Queue
22
from threading import Thread
33
from glouton.commands.download.downloadCommandParams import DownloadCommandParams
4-
from glouton.commands.download.payloadDownloadCommand import PayloadDownloadCommand
4+
from glouton.commands.download.archiveDownloadCommand import ArchiveDownloadCommand
55
from glouton.workers.downloadWorker import DownloadWorker
66
from glouton.workers.moduleWorker import ModuleWorker
77
from glouton.domain.interfaces.downloadable import Downloadable
88
from glouton.shared import threadHelper
99
from threading import Event
1010

1111

12-
class PayloadRepo(Downloadable):
12+
class ArchiveRepo(Downloadable):
1313
def __init__(self, working_dir, modules):
1414
self.__working_dir = working_dir
15-
self.__payload_commands = Queue()
16-
self.__payload_modules_commands = Queue()
15+
self.__archive_commands = Queue()
16+
self.__archive_modules_commands = Queue()
1717
self.__modules = modules
1818
self.__download_status = Event()
1919

2020
def register_command(self, observation, start_date, end_date):
2121
cmd_parameters = DownloadCommandParams(
2222
self.__working_dir, self.__create_dir_name('archive', start_date, end_date), self.__modules)
23-
waterfallDownloadCommand = PayloadDownloadCommand(
24-
cmd_parameters, observation, self.__payload_modules_commands)
25-
self.__payload_commands.put(waterfallDownloadCommand)
23+
waterfallDownloadCommand = ArchiveDownloadCommand(
24+
cmd_parameters, observation, self.__archive_modules_commands)
25+
self.__archive_commands.put(waterfallDownloadCommand)
2626

2727
def create_worker(self):
2828
threads = []
2929
downloadWorker = DownloadWorker(
30-
self.__payload_commands, self.__download_status)
30+
self.__archive_commands, self.__download_status)
3131
threads.append(threadHelper.create_thread(downloadWorker.execute))
3232
if self.__modules is not None:
3333
moduleWorker = ModuleWorker(
34-
self.__payload_modules_commands, self.__download_status)
34+
self.__archive_modules_commands, self.__download_status)
3535
threads.append(threadHelper.create_thread(moduleWorker.execute))
3636

3737
return threads

glouton/requirements.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
requests==2.21.0
1+
requests==2.24.0

glouton/services/module/moduleService.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -17,14 +17,14 @@ def loadDemoddataModules(self):
1717

1818
return self.__loadModule(self.__cmd.demoddata_modules)
1919

20-
def loadPayloadModules(self):
20+
def loadArchiveModules(self):
2121
logger.Info('Archive module(s) loading :')
22-
self.__cmd.payload_modules = self.__getModulesFromConfig(
23-
self.__cmd.payload_modules, 'PAYLOAD')
24-
self.__cmd.payload_modules = self.__getModulesFromConfig(
25-
self.__cmd.payload_modules, 'FOR_ALL_OBSERVATION')
22+
self.__cmd.archive_modules = self.__getModulesFromConfig(
23+
self.__cmd.archive_modules, 'ARCHIVE')
24+
self.__cmd.archive_modules = self.__getModulesFromConfig(
25+
self.__cmd.archive_modules, 'FOR_ALL_OBSERVATION')
2626

27-
return self.__loadModule(self.__cmd.payload_modules)
27+
return self.__loadModule(self.__cmd.archive_modules)
2828

2929
def loadWaterfallModules(self):
3030
logger.Info('Waterfall module(s) loading :')

glouton/services/observation/observationsService.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
from glouton.services.module.moduleService import ModuleService
22
from glouton.repositories.demoddata.demoddataRepo import DemoddataRepo
3-
from glouton.repositories.payload.payloadRepo import PayloadRepo
3+
from glouton.repositories.archive.archiveRepo import ArchiveRepo
44
from glouton.repositories.waterfall.waterfallRepo import WaterfallRepo
55
from glouton.repositories.observation.observationsRepo import ObservationRepo
66

@@ -14,10 +14,10 @@ def __init__(self, cmd):
1414

1515
def filter_repositories(self):
1616
downloadable_data_repos = []
17-
all = not self.__cmd.payloads and not self.__cmd.waterfalls and not self.__cmd.demoddata
18-
if all or self.__cmd.payloads:
19-
downloadable_data_repos.append(PayloadRepo(
20-
self.__cmd.working_dir, self.__module_service.loadPayloadModules()))
17+
all = not self.__cmd.archives and not self.__cmd.waterfalls and not self.__cmd.demoddata
18+
if all or self.__cmd.archives:
19+
downloadable_data_repos.append(ArchiveRepo(
20+
self.__cmd.working_dir, self.__module_service.loadArchiveModules()))
2121
if all == True or self.__cmd.waterfalls:
2222
downloadable_data_repos.append(WaterfallRepo(
2323
self.__cmd.working_dir, self.__module_service.loadWaterfallModules()))

0 commit comments

Comments
 (0)