Skip to content

Loosen requirements - #65

Merged
efischer19 merged 1 commit into
masterfrom
efischer/loosen_reqs
Aug 2, 2017
Merged

Loosen requirements#65
efischer19 merged 1 commit into
masterfrom
efischer/loosen_reqs

Conversation

@efischer19

Copy link
Copy Markdown
Contributor

@doctoryes is this a thing we do, organizationally speaking? I know it adds a bit of risk (what if the package maintainer does something evil with a minor version release?), but if everyone uses semver properly it should allow for easier upgrades. I need to loosen dogapi in particular in order to do something similar for ora's requirements

(in the process of a setup.py install for edx-ora2)

Processing dependencies for ora2==1.4.8
error: dogapi 1.11.1 is installed but dogapi==1.2.1 is required by set(['edx-submissions'])

@doctoryes

Copy link
Copy Markdown
Contributor

These djangoapp modules should have their requirements pinned as loosely as possible - basically only guarding against known incompatibilities or future, likely incompatibilities released under a larger semver number. It should be the encompassing Django project that decides on the version within that loose range.

@doctoryes

Copy link
Copy Markdown
Contributor

Looks like UUIDField is used from django-extensions....

@efischer19

Copy link
Copy Markdown
Contributor Author

@efischer19
efischer19 force-pushed the efischer/loosen_reqs branch 6 times, most recently from f1949aa to 9f8c903 Compare July 28, 2017 17:30
Also, removes dependency on django-extensions
@efischer19
efischer19 force-pushed the efischer/loosen_reqs branch from 9f8c903 to bbf9b61 Compare July 28, 2017 17:33
@efischer19

Copy link
Copy Markdown
Contributor Author

@doctoryes, this is ready for review now. I've loosened all the requirements versions, eliminated django-extensions (as it's no longer needed), and touched up a bit of string-vs-UUID logic related to that removal to keep tests happy.

@doctoryes doctoryes left a comment

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.

LGTM - as long as migration implications are figured out.

name='uuid',
field=models.UUIDField(default=uuid.uuid4, db_index=True),
),
]

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's the deployment implications of this migration? How big is the submissions_submission table on production?

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.

This is a good question - the only change is a semantic one around the uuid field (it has no practical effect on normal usage), but the output of manage.py sqlmigrate is not something I'd expect:

BEGIN;
ALTER TABLE `submissions_submission` ALTER COLUMN `uuid` SET DEFAULT '240af22377d44f82817ee79b1a5fd61d';
ALTER TABLE `submissions_submission` ALTER COLUMN `uuid` DROP DEFAULT;

COMMIT;

The size of the table is 1.7M rows in prod. However, I would argue that the above is effectively a no-op, and we ought to just skip applying the migration entirely.

@jibsheet, any suggestions here? I'm attempting to remove the django_extensions requirement on this project, and it's used in a model field. That change necessitated a migration, which when poked seems to do nothing, effectively. Can we declare this "safe to skip" and include a --fake in the GoCD rollout of this code change? Is that even possible?

If this turns out to be too complex, I'm fine with reverting the django_extensions removal out.

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Last time I ran across this, it's a django stupidity but MySQL Innodb treats it as a metadata change: https://github.com/edx/edx-platform/pull/14830#discussion_r110185023

You can probably make a million row table on a sandbox to test, but when I did something similar for Christina, it was fine. I'll mention that the behavior might differ on nullable fields, but I'd be shocked if a uuid field was NULLable.

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 awesome, thanks for the links @jibsheet. I'll test this out on a sandbox tomorrow and get back to you.

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.

Running against a sandbox with 200K rows on the table in question:

edxapp@ip-192-168-0-15:~/edx-platform$ time ./manage.py lms --settings=aws migrate submissions 0004
<lots of django warnings>
2017-08-02 09:56:21,582 INFO 12833 [dd.dogapi] dog_stats_api.py:66 - Initializing dog api to use statsd: localhost, 8125
Operations to perform:
  Target specific migration: 0004_remove_django_extensions, from submissions
Running migrations:
  Rendering model states... DONE
  Applying submissions.0004_remove_django_extensions... OK

real	0m6.412s
user	0m5.656s
sys	0m0.676s

From my perspective, the Applying submissions.0004_remove_django_extensions portion was nearly instantaneous, the 5 seconds were spent in django warmups and model state rendering.

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Yep, that sounds reasonable

Comment thread settings.py

# Third party
'django_extensions',

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.

Good to see dependencies removed!

@efischer19

Copy link
Copy Markdown
Contributor Author

Per @jibsheet and I's offline discussion, I'm going to push this out to prod separate of openedx/edx-ora2#1023

@efischer19
efischer19 merged commit 86e209a into master Aug 2, 2017
@efischer19
efischer19 deleted the efischer/loosen_reqs branch August 2, 2017 15:01
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