Skip to content
This repository was archived by the owner on Sep 28, 2020. It is now read-only.
This repository was archived by the owner on Sep 28, 2020. It is now read-only.

setup.py -gX is very slow #471

@jisantuc

Description

@jisantuc

Problem Description

setup.py ... -gX is extremely quiet and incredibly slow. In an attempt to load all three levels of the sample data -- which is a totally reasonable thing to do that probably everyone who works on district builder will end up doing -- I've had it running for 20 minutes now and it's still going. That's not acceptable.

Replication Steps

  • first, from the django container:
./setup.py config/config.xsd config/config.xml -g0 -g1 -g2
  • separately: docker-compose exec django ./manage.py dbshell
  • start a timer when you run: select count(1) from redistricting_geounit;
  • wait thirty seconds
  • run that sql command again
  • observe how many records have been inserted
  • note privately that there are OVER 9,000 (I have no idea how many but it is more than 9,000) records that will be inserted
  • also note that the command gives you no indication that it's doing anything, and that if you didn't know where to look in the database to watch the record count increase, you'd have to fall back on checking cpu utilization in the django container to confirm that anything is going on, which is bad
  • 😢

Expected Behavior or Output

Loading development data should take under twenty minutes. I think there's an easy win here -- instead of going geounit by geounit, checking what we need to do, and saving each one, we could build an array of geounits and insert them all at once. That would be risky for a file coming in from Somewhere Else in the Universe:tm:, but it's fine for a known well-formatted source.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions