Opened 2 years ago

Closed 13 months ago

Last modified 12 months ago

#22258 closed New feature (fixed)

Show progress during dumpdata

Reported by: Gwildor Owned by: mrfuxi
Component: Core (Management commands) Version: master
Severity: Normal Keywords:
Cc: Triage Stage: Ready for checkin
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no


In response of ticket #22251, I'm opening this as a separate issue like requested. You can read the need for this option there, but shortly speaking, the commands as they are now are not user friendly at all. The commands can go on for a very long time, depending on your database size, without giving any clue of its state and progress.

If and when #22257 is implemented, the commands could start by collecting amount of rows to progress, and periodically printing the progress to the console. This way the user can make a fair estimate on when the commands are done and whether they are actually still running.

Attachments (1)

22258#test.diff (1.2 KB) - added by anubhav9042 2 years ago.

Download all attachments as: .zip

Change History (11)

comment:1 Changed 2 years ago by aaugustin

  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset
  • Triage Stage changed from Unreviewed to Accepted

comment:2 Changed 2 years ago by anubhav9042

We can add the patch given #22257, then as posted there:
I think we can keep default as stdout and and for this, we can do the following:

  • When -o is not used, let the data be printed to stdout, as the data is printing people can see it and I don't think any progress display is required there.
  • When -o will be used, then we can display progress percentage or something like that.

backwards compatibilty is there, also issue here is also addressed.

comment:3 Changed 2 years ago by russellm

Before we get too carried away here, someone needs to explain how it's going to be implemented. json.dumps and lxml don't provide progress APIs AFAIK.

comment:4 Changed 2 years ago by anubhav9042

Well I am attaching a simple diff just for JSON. It does very simply does the job of displaying progress(random not actual), but we can think along similar lines like we could calculate total no. of objects and then print progress accurately depending upon no of objects serialized.

Changed 2 years ago by anubhav9042

comment:5 Changed 23 months ago by mrfuxi

  • Owner changed from nobody to mrfuxi
  • Status changed from new to assigned

I was thinking of adding some kind of utility to allow showing progress from any management command.

As far as I looked (loading data) there is no clean way of showing % of progress because of generators/reading streams from files, so progress like during tests. For data load it might be possible to show proper progress bar.

comment:6 Changed 13 months ago by claudep

  • Has patch set
  • Needs tests set

188a2418807f661eedfc675731521f2f46a3c49a (#21652) added progress information for loaddata.

This PR is adding progress report for dumpdata:

comment:7 Changed 13 months ago by claudep

  • Needs tests unset

comment:8 Changed 13 months ago by timgraham

  • Summary changed from Show progress during dumpdata and loaddata to Show progress during dumpdata
  • Triage Stage changed from Accepted to Ready for checkin

comment:9 Changed 13 months ago by Claude Paroz <claude@…>

  • Resolution set to fixed
  • Status changed from assigned to closed

In c296e55:

Fixed #22258 -- Added progress status for dumpdata when outputting to file

Thanks Gwildor Sok for the report and Tim Graham for the review.

comment:10 Changed 12 months ago by Tim Graham <timograham@…>

In eaa3c88:

Refs #22258 -- Fixed an unclosed temporary file in fixtures test.

This prevented the temporary directory from being removed
on Windows.

Note: See TracTickets for help on using tickets.
Back to Top