Skip to content
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

Issue1 gcmd short names #52

Closed
wants to merge 40 commits into from
Closed

Issue1 gcmd short names #52

wants to merge 40 commits into from

Conversation

mortenwh
Copy link
Contributor

@mortenwh mortenwh commented Feb 6, 2019

#1

…st version of Aqua platform keywords (was AQUA before)
…from ForeignKey source to ManyToManyField sources, changed __str__ method of Source to rely on platform and instrument only (not specs) and removed the field specs.
…de itself. Assert that the entry_title is now equal to the filename, test new use of 'platform/instrument' as list
…t and parameter instead of source. This is still ongoing..
… there is extra information linked to the connection between two models. In this case, we don't have that...
…new migrations, and updated fixtures. This also applies to #51
@coveralls
Copy link

coveralls commented Feb 6, 2019

Pull Request Test Coverage Report for Build 202

  • 270 of 284 (95.07%) changed or added relevant lines in 21 files are covered.
  • 14 unchanged lines in 2 files lost coverage.
  • Overall coverage increased (+1.2%) to 93.614%

Changes Missing Coverage Covered Lines Changed/Added Lines %
geospaas/catalog/migrations/0007b_migrate_source_data.py 8 14 57.14%
geospaas/catalog/migrations/0008b_migrate_parameters_data.py 9 17 52.94%
Files with Coverage Reduction New Missed Lines %
geospaas/vocabularies/tests.py 6 97.93%
geospaas/vocabularies/managers.py 8 89.03%
Totals Coverage Status
Change from base Build 171: 1.2%
Covered Lines: 1554
Relevant Lines: 1660

💛 - Coveralls

@mortenwh
Copy link
Contributor Author

mortenwh commented Feb 6, 2019

I'm not sure how to test the data migrations automatically (i.e., geospaas/catalog/migrations/0007b_migrate_source_data.py and
geospaas/catalog/migrations/0008b_migrate_parameters_data.py) but this was done manually as described in #1.

Copy link
Member

@akorosov akorosov left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks ok. Just few things:

  1. Too many migrations - maybe some can be squashed?
  2. Too verbose output for some vocabularies. Is it really necessary? Looks like it kills the usability of __str__ method (That was not in the original issue, BTW. We should try to make PRs small and focused on the issues only).
  3. Dosn't matter since we swtich to Docker soon (hopefully) but it is better not to provide IP in Vagrantfile and ansible as it may conflict with other VMs or containers.

@@ -10,6 +10,7 @@ Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
config.vm.box_url = "https://atlas.hashicorp.com/ubuntu/trusty64"

config.vm.define "geospaas", primary: true do |geospaas|
geospaas.vm.network :private_network, ip: "192.168.33.10"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is not needed. In fact it can conflict with other VMs for other projects. If not specified, vagrant allocates free IP to the VM without conflicts.

operations = [
migrations.AddField(
model_name='dataset',
name='newparameters',
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you squash these migrations? You added newparameters and then removed it but generated migrations in between.

@@ -131,13 +128,14 @@ class Dataset(models.Model):
]
)
entry_title = models.CharField(max_length=220)
parameters = models.ManyToManyField(Parameter, through='DatasetParameter')
#parameters = models.ManyToManyField(Parameter, through='DatasetParameter')
parameters = models.ManyToManyField(Parameter)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you also remove the model DatasetParameter if it is not used anymore?


def test_source__str__method(self):
# Assure __str__ method returns correct string
expected_str = 'Platform: (Category: Earth Observation Satellites, Series Entity: , Short Name: ' \
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That looks terrible. IMHO now Source.__str__ is not usable.

@@ -42,10 +44,13 @@ class Instrument(models.Model):
objects = InstrumentManager()

def __str__(self):
return str(self.short_name)
return 'Category: %s, Instrument Class: %s, Type: %s, Subtype: %s, Short Name: %s, ' \
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do we need that? What is the workflow? It looks too verbose but adds no information.

@mortenwh
Copy link
Contributor Author

mortenwh commented Feb 24, 2019

This bug was in issue40_thredds_crawler - needs to be checked as well...

    149     def __str__(self):
    150         return '%s/%s/%s' % (self.source.platform, self.source.instrument,
--> 151                 self.time_coverage_start.isoformat())
    152 
    153 # Keep this for reference if we want to add it

AttributeError: 'str' object has no attribute 'isoformat'

@akorosov
Copy link
Member

A much simple solution was proposed in #80.

@akorosov akorosov closed this Mar 30, 2020
@akorosov akorosov deleted the issue1_gcmd_short_names branch March 30, 2020 11:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants