Skip to content

Tox, for parallel test goodness - #1023

Merged
efischer19 merged 3 commits into
masterfrom
efischer/tox
Aug 2, 2017
Merged

Tox, for parallel test goodness#1023
efischer19 merged 3 commits into
masterfrom
efischer/tox

Conversation

@efischer19

Copy link
Copy Markdown
Contributor

EDU-768

Attempts to split each of the following into separate test contexts on travis:

  • django 1.8 python tests
  • django 1.11 python tests
  • quality checks
  • js tests

@efischer19

efischer19 commented Jul 10, 2017

Copy link
Copy Markdown
Contributor Author

This has now morphed into a "modernize ORA" PR. With the goal of faster, smaller, parallelized tests, I'll be doing the following:

  • modify installation, there's no reason we need to specify apt-packages. Requirements were also getting silly.
  • remove AI grading, that eats a lot of testing cycles for a feature that isn't enabled anywhere. I'll double-check with product to ensure this is acceptable.
  • tests will be more direct, and not make use of "travis calls tox calls makefile calls a bash script"

@efischer19
efischer19 force-pushed the efischer/tox branch 4 times, most recently from 979751f to 01cb48b Compare July 13, 2017 20:02
@efischer19

Copy link
Copy Markdown
Contributor Author

Running into an order-dependent flaky test in test_training.py, under --hashseed 2507972091

Comment thread requirements/tox.txt Outdated
django-nose==1.4.4
git+https://github.com/edx/django-rest-framework.git@1ceda7c086fddffd1c440cc86856441bbf0bd9cb#egg=djangorestframework==3.6.3
dogapi==1.11.1
jsonfield==2.0.2

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

@michaelroytman just saw your recent branch - I'm upgrading jsonfield here as part of https://openedx.atlassian.net/browse/EDUCATOR-768

Comment thread requirements/tox.txt Outdated
@@ -0,0 +1,22 @@
# edX Internal Requirements
git+https://github.com/edx/XBlock.git@efischer/play_nice_with_py27#egg=XBlock==1.0.0

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Relies on https://github.com/edx/XBlock/pull/365, which is currently unmerged.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Merged and updated

@efischer19

efischer19 commented Jul 24, 2017

Copy link
Copy Markdown
Contributor Author

Ready for review! @cahrens has volunteered to be a reviewer (thanks again!); @edx/educator-dahlia FYI as well.

Other subtasks before I close EDUCATOR-409:

Comment thread logs/README.txt
@@ -1,7 +0,0 @@
Log files:

apps_info.log = INFO level logging for all edx-ora2 apps and OpenAssessmentBlock

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Should this information be captured someplace else? It seems like it could be useful (assuming it is still true).

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I don't believe this info is true any longer, edx-platform defines logging locations (which work with splunk), and this particular file is >3 years past its last update.

Comment thread openassessment/assessment/models/ai.py Outdated
)
AssessmentPart.create_from_option_points(self.assessment, criterion_scores)
self.mark_complete_and_save()
# This file is empty, but we cannot delete it b/c historical migration records refer to it.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Is this still true given our discussion?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I will double check on this one - it could be in a weird intermediary state from my internal debate about dealing with migrations.

"""
# pylint:disable=W0611
from .worker.training import train_classifiers, reschedule_training_tasks
from .worker.grading import grade_essay, reschedule_grading_tasks

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Why is worker.grading removed?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Everything under worker has been removed - the idea was to "train" your AI classifiers with a given data set ahead of time, then "grade" new essays as a separate phase. We don't need any references to either of these operations.

try:
temp_url = swiftclient.utils.generate_temp_url(
path='%s/%s/%s' % (url.path, bucket_name, key_name),
path='/v%s%s/%s/%s' % (SWIFT_BACKEND_VERSION, url.path, bucket_name, key_name),

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Will this cause any incompatibilities for people who are already using the Swift backend?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

It shouldn't, this only affects newly generated upload urls.

from openassessment.assessment.models import PeerWorkflow


class Command(BaseCommand):

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Why was this file deleted?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I yanked out all performance tests as well, as they also heavily blurred the line between "python library" and "suite of scripts and programs to install, some of which may be python". The tests that were here were incredibly old, I think if we need performance testing against ora we're better off rewriting it in https://github.com/edx/edx-load-tests using the modern locust setup described there.

# Expect that we generated a URL for the bucket
url = cmd.history[0]['url']
self.assertIn("https://{}".format(self.BUCKET_NAME), url)
self.assertIn("ttps://s3.amazonaws.com/{}".format(self.BUCKET_NAME), url)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Why is the "h" missing from the front?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Terrible copy-paste job by the dev who put this here, what a bum that guy must be (thanks, will fix)

self.possible_points = 2
peer_api.get_submission_to_assess(self.scorer_submission['uuid'], 1)
self.assessment = self._create_assessment(self.scorer_submission['uuid'])
self.assertEqual(self.assessment['parts'][0]['criterion']['label'], "criterion_1")

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

What caused this change (and the lines below, 475 and following?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

It was a flaky test issue. A particular hashseed value caused the assessment to store out-of-order values, until I made this fix. Now, this test ensures that self.assessment['parts'][0] matches up to the first criterion and appears first in the downloaded data.


.action--save {
@extend %action-button
@extend %action-button !optional

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Why was this necessary?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

It was failing quality builds, not sure why it hadn't been before. I'll double-check to ensure that's still the case.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

@extend %action-button !optional
}

.feedback {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Is there CSS that should be deleted related to AI grading? I'm thinking of the Studio editors, as well as the LMS view.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Oh, good call. I'll do an audit of that before the next round of review

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I've poked around - no files are obviously AI grading exclusive, and I can't see any obvious removals in the existing files. Judging by that and the fact that very little HTML needed to be removed, I think we're safe assuming that this feature never had a lot of dedicated front-end customization done.

# If the problem already contains example-based assessment
# then allow the editor to display example-based assessments,
# which is not included in the default
enabled_assessments = [asmnt['name'] for asmnt in self.valid_assessments]

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Have you checked that no ORA instances in prod/Edge have AI steps defined? Just wondering how they would fail.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

From my database poking, I don't believe there are any. I'll verify that, and set up such a problem locally to ensure we can handle that situation correctly.

Comment thread scripts/run-pep8.sh Outdated
#!/usr/bin/env bash

MAX_PEP8_VIOLATIONS=106
MAX_PEP8_VIOLATIONS=62 # TODO nomerge - but also stop failing during development

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Don't forget to follow up on this.

Comment thread scripts/run-pylint.sh Outdated
#!/usr/bin/env bash

MAX_PYLINT_VIOLATIONS=438
MAX_PYLINT_VIOLATIONS=495 # TODO nomerge - but also stop failing during development

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Don't forget to follow up on this.

Performance Tests
=================

1. Install performance test requirements:

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

No more performance tests?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Correct, I've eliminated them from this repo for reasons outlined above.

@cahrens

cahrens commented Jul 24, 2017

Copy link
Copy Markdown
Contributor

What are the .gitkeep files?

@efischer19

Copy link
Copy Markdown
Contributor Author

Alright @cahrens, I believe this is ready again, I've addressed all your comments from before. The diff of the latest commit looks scary, but a large portion of it was me running isort to standardize all our import statements (which fixed a huge number of quality errors).

I'm also running acceptance tests at https://gocd.tools.edx.org/go/pipelines/value_stream_map/build_ora2_sandbox/142.

Comment thread requirements/base.txt Outdated
# edX Internal Requirements
git+https://github.com/edx/XBlock.git@xblock-0.4.12#egg=XBlock==0.4.12
# edx-submissions>=2.0.6,<3.0.0 #TODO: update after 2.0.6 release
git+https://github.com/edx/edx-submissions.git@efischer/loosen_reqs#egg=edx-submissions==2.0.6 # TODO: and remove this line

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

These two lines are effectively "I'm waiting for openedx/edx-submissions#65 to merge before this"

Comment thread Makefile
# Install commands
##################
install-python:
pip install -r requirements/django.txt

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Why a separate file?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I see-- because of the tox configuration. Never mind.

from django.db import migrations, models


class Migration(migrations.Migration):

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

What caused this migration?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

It's the same thing that's happening here - We can remove the django_extensions dependency fairly easily, but that touches a field on a model, which leads to a migration. Said migration should be a no-op, but there are some pending operational questions to sort out.

The migration should have been in the last commit; I had forgotten that it needed to be generated and ran into a "please run makemigrations" warning while fixing other things. I'll work out the details with Kevin on my other PR and update this one with the results of that conversation.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Update: we're pushing the submissions upgrade through independently, as it had an identical migration. Expectation is that it runs as a no-op, we're going to verify that as submissions goes out since it's a smaller table.

Comment thread requirements/base.txt
# edX Internal Requirements
# edx-submissions>=2.0.6,<3.0.0 #TODO: update after 2.0.6 release
git+https://github.com/edx/edx-submissions.git@efischer/loosen_reqs#egg=edx-submissions==2.0.6 # TODO: and remove this line
git+https://github.com/edx/django-rest-framework.git@1ceda7c086fddffd1c440cc86856441bbf0bd9cb#egg=djangorestframework==3.6.3

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Why a specific commit of django-rest-framework?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

@doctoryes set this requirement to a specific commit in #1024, I'm just moving it to another file

Comment thread setup.cfg
known_third_party = ddt,mock
known_django = django
known_djangoapp = jsonfield,model_utils
known_edx =

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

known_edx?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Yeah, it has something to do with isort configuration. I copied this over from https://github.com/edx/edx-celeryutils/blob/master/setup.cfg, I think we can remove the known_edx line

Comment thread settings/base.py Outdated
@@ -93,6 +92,12 @@
'django.template.loaders.filesystem.Loader',

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

These are the default values, so TEMPLATE_LOADERS can be removed.

https://docs.djangoproject.com/en/1.11/ref/templates/upgrading/

Comment thread settings/base.py Outdated
from celery import Celery

DEBUG = True
TEMPLATE_DEBUG = DEBUG

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I believe you should remove TEMPLATE_DEBUG. You can include 'debug' in the TEMPLATES options.

For example,

TEMPLATES = [
    {
        'BACKEND': 'django.template.backends.django.DjangoTemplates',
        'DIRS': [
            os_path.join(PROJECT_PATH, 'templates'),
        ],
        'APP_DIRS': True,
        'OPTIONS': {
            'context_processors': [
                "django.contrib.auth.context_processors.auth",
                "django.template.context_processors.debug",
                "django.template.context_processors.i18n",
                "django.template.context_processors.media",
                "django.template.context_processors.static",
                "django.template.context_processors.request",
                "django.template.context_processors.tz",
                "django.contrib.messages.context_processors.messages",
                "sekizai.context_processors.sekizai",
            ],
            'debug': DEBUG,
        },
    },
]

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Also, STATICFILES_DIRS and STATICFILES_FINDERS can be removed.

https://docs.djangoproject.com/en/1.11/ref/settings/#std:setting-STATICFILES_FINDERS

@cahrens

cahrens commented Jul 31, 2017

Copy link
Copy Markdown
Contributor

This seems very odd:

image

Sorry... didn't mean to close, just comment!

@cahrens cahrens closed this Jul 31, 2017
@cahrens cahrens reopened this Jul 31, 2017
@cahrens

cahrens commented Jul 31, 2017

Copy link
Copy Markdown
Contributor

@efischer19 done re-reviewing-- just a few more comments/questions.

@efischer19

Copy link
Copy Markdown
Contributor Author

Thanks for the review @cahrens! I think I've answered all your questions, will get this updated witch code changes and ready for merge in the next day or so.

This work was done in the context of a larger PR, I'd be shocked if
this commit can be successfully reverted by itself. If you're trying
to restore AI grading though, it's a good place to start.
@efischer19

efischer19 commented Aug 2, 2017

Copy link
Copy Markdown
Contributor Author

We're back - latest commit has:

  • updated location of developer wiki links (I'm going to be editing those soon to explain docker devstack setup FYI)
  • finalized edx-submissions requirement to 2.0.6, since that merged
  • lowered pylint error limit, since I was well below it
  • cleaned up settings/base.py as suggested
  • preemptively fixed a flaky test I noticed earlier this morning

Once tests have passed and everyone is happy, I'll get this squashed, merged, and deployed

@cahrens

cahrens commented Aug 2, 2017

Copy link
Copy Markdown
Contributor

👍

Eric Fischer added 2 commits August 2, 2017 15:49
Contains installation and testing changes for the django 1.11 upgrade
preparedness initiative. Splits tests out into seperate shards on travis.
Code changes needed to work with the upgraded dependencies from the
previous commit.
@efischer19
efischer19 merged commit 60f6ea3 into master Aug 2, 2017
@efischer19
efischer19 deleted the efischer/tox branch August 2, 2017 21:19
@efischer19

Copy link
Copy Markdown
Contributor Author

🎆

Thanks for the help here @cahrens!

I'm going to get this deployed tomorrow

@cahrens

cahrens commented Aug 3, 2017

Copy link
Copy Markdown
Contributor

🚀

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.

2 participants