-
Notifications
You must be signed in to change notification settings - Fork 17
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Clean up build of input index file #234
base: master
Are you sure you want to change the base?
Conversation
def __init__ (self, config): | ||
self.config = config | ||
self.data = InputData.read() | ||
self.info_files = InputInfoCollection.read() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This line creates a list of all info files which are present in the input folder (step 1 in comment).
self.info_files = InputInfoCollection.read() | ||
|
||
def run(self): | ||
self._validate_info_files() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here, all info files which are present in the input folder are validated (step 2 in comment).
|
||
def run(self): | ||
self._validate_info_files() | ||
self._make_index_file_for_input() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This line creates the input index file and stores it (step 3 in comment).
resource.location = str(info_filename.parent.relative_to(self.config.in_path) / dataset) | ||
resources.append(resource) | ||
|
||
self.index = GammaCatResourceIndex(resources).sort() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am not sure whether this definition of the class instance variable self.index
is pythonic or not. Currently, self.index is not used anywhere but I think in the future we will handle a lot of things via this index, hence, it is nice to have it as a class instance variable.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If it's not used from elsewhere at the moment, better to keep it as a local variable only.
Use InputCollection class in make.py
Use InputInfoCollection to build index file
@@ -212,8 +251,6 @@ def run(self): | |||
step = self.config.step | |||
if step == 'all': | |||
self.process_all() | |||
elif step == 'input-index': |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is not working anymore because it is not handled in this class.
@@ -233,7 +270,6 @@ def input_data(self): | |||
return InputData.read() | |||
|
|||
def process_all(self): | |||
self.make_index_file_for_input() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same as above. Not part of this class anymore.
@@ -45,7 +45,10 @@ def cli_collection(step): | |||
out_path=gammacat_info.out_path, | |||
step=step, | |||
) | |||
CollectionMaker(config).run() | |||
if (step == 'input-index'): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I know, this looks ugly and need follow up change! But it works, hence, I would leave it as it is for now and change it later.
I don't understand the error of travis ci. It is a http error? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
resource.location = str(info_filename.parent.relative_to(self.config.in_path) / dataset) | ||
resources.append(resource) | ||
|
||
self.index = GammaCatResourceIndex(resources).sort() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If it's not used from elsewhere at the moment, better to keep it as a local variable only.
Honestly, I don't know whether you can merge this now after merging #211 :-D |
This PR is on top of #211. Hence, you should firstly review and merge #211 before looking at the diff of this PR!
The plan is to have to classes
InputCollection
andOutputCollection
each handling - as the names suggests - every data in the input and output folders, respectively.This PR starts to write the
InputCollection
and it implements to first things:info.yaml
files (stored in input folder) is created via the classInputInfoCollection
(see inline comment).input_index_file
is created after (!) the info-files are validated (see inline comment).Step 2) and 3) are handled via a
run
function inInputCollection
(see inline comment).In the future these three steps should be the very first thing
make.py
does! This PR does not (!) change the procedure ofmake.py
, it only introduces a ugly way to run the upper steps whenmake.py collection --step input-index
is executed (see inline comment). There needs to be done a follow up PR which cleans upmake.py
.The second small commit is only a small fix in the
_make_index_file_input
function so that it uses theto_list()
function ofInputInfoCollection
. But the functionality is not changed.