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

files:scan add number of items per second on printed result table #32089

Merged
merged 1 commit into from
Jul 19, 2018

Conversation

mmattel
Copy link
Contributor

@mmattel mmattel commented Jul 18, 2018

Description

This PR adds to the table printout of files:scan the items per second processed

Related Issue

Motivation and Context

Prints a calculated performance.
Note: on low number of seconds the result may differ a bit because fractions of a second are calculated but only seconds are shown in the table

How Has This Been Tested?

sudo -uwww-data ./occ files:scan --path="user_1/files/mount_folder_1"

Scanning files for 1 users
Starting scan for user 1 out of 1 (user_1)

+---------+-------+--------------+------------------+
| Folders | Files | Elapsed time | Items per second |
+---------+-------+--------------+------------------+
| 60      | 863   | 00:00:06     | 149              |
+---------+-------+--------------+------------------+

sudo -uwww-data ./occ files:scan --path="user_1/files/mount_folder_2"

Scanning files for 1 users
Starting scan for user 1 out of 1 (user_1)

+---------+-------+--------------+------------------+
| Folders | Files | Elapsed time | Items per second |
+---------+-------+--------------+------------------+
| 1027    | 14903 | 00:02:57     | 169              |
+---------+-------+--------------+------------------+

Screenshots (if appropriate):

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Technical debt
  • Tests

Checklist:

  • Code changes
  • Unit tests added
  • Acceptance tests added
  • Documentation ticket raised:

Open tasks:

  • Backport (if applicable set "backport-request" label and remove when the backport was done)

@mmattel
Copy link
Contributor Author

mmattel commented Jul 19, 2018

@phil-davis can your restart drone, many thanks (Error: Client.Timeout exceeded while awaiting headers)

Copy link
Contributor

@PVince81 PVince81 left a comment

Choose a reason for hiding this comment

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

Nice idea, see comments.

@@ -444,11 +444,13 @@ protected function presentStats(OutputInterface $output) {
*/
protected function showSummary($headers, $rows, OutputInterface $output) {
$niceDate = $this->formatExecTime();
$items_per_second = $this->getItemsPerSecond();
Copy link
Contributor

Choose a reason for hiding this comment

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

please use camel case (I hope php-cs-fixer spots this!)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

thx, just fixing it

} else {
$items_per_second = $items / $this->execTime;
}
return \sprintf("%.0f", $items_per_second);
Copy link
Contributor

Choose a reason for hiding this comment

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

I suggest returning the float value here and format it later when adding to the table, also add a unit to the formatted text, for example "%.0f items/seconds"

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I followed the same way to return / print the time used. It returns the final string to be printed.
Adding the unit does not make sense, as the table header already says what it is: Items per second.
You can see it in the example printouts.

Copy link
Contributor

Choose a reason for hiding this comment

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

as yes, I missed the headers. nice

@PVince81 PVince81 added this to the development milestone Jul 19, 2018
@PVince81
Copy link
Contributor

From what I see adding a unit test assertion would be tricky due to the time element and not that useful.

Copy link
Contributor

@PVince81 PVince81 left a comment

Choose a reason for hiding this comment

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

👍

@codecov
Copy link

codecov bot commented Jul 19, 2018

Codecov Report

Merging #32089 into master will increase coverage by <.01%.
The diff coverage is 80%.

Impacted file tree graph

@@             Coverage Diff              @@
##             master   #32089      +/-   ##
============================================
+ Coverage     63.83%   63.83%   +<.01%     
- Complexity    18554    18556       +2     
============================================
  Files          1169     1169              
  Lines         69719    69728       +9     
  Branches       1264     1264              
============================================
+ Hits          44504    44511       +7     
- Misses        24846    24848       +2     
  Partials        369      369
Flag Coverage Δ Complexity Δ
#javascript 52.59% <ø> (ø) 0 <ø> (ø) ⬇️
#phpunit 65.11% <80%> (ø) 18556 <2> (+2) ⬆️
Impacted Files Coverage Δ Complexity Δ
apps/files/lib/Command/Scan.php 71.83% <80%> (+0.19%) 74 <2> (+2) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 63db3f1...0b8edef. Read the comment docs.

@phil-davis phil-davis merged commit 7dc775b into master Jul 19, 2018
@phil-davis phil-davis deleted the add_ops_per_second branch July 19, 2018 10:26
@lock
Copy link

lock bot commented Jul 30, 2019

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@lock lock bot locked as resolved and limited conversation to collaborators Jul 30, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Feature Request] Improve console output for files scan command
4 participants