add duration of the scan to JSON
Short Description
currently there is already a start time stamp and end time stamp in the JSON output. It would be nice to also have a "duration" field so I don't have to compute that myself.
Possible Labels
- new feature
Select Category
- Enhancement [X]
- Add License/Copyright []
- Scan Feature []
- Packaging []
- Documentation []
- Expand Support []
- Other []
Describe the Update
How This Feature will help you/your organization
Possible Solution/Implementation Details
end_timestamp - start_timestamp
Example/Links if Any
Can you help with this Feature
@armijnhemel Thank you for this: would a duration in seconds work as in 7776045? (as opposed to a human readable and formatted string such as 3:12:45 for 3 hours, 12 minutes and 45 seconds?
Note also this cannot be 100% accurate as the actual time it takes to write the JSON cannot be integrated, and this could be several seconds on large scans.
@armijnhemel Thank you for this: would a duration in seconds work as in
7776045? (as opposed to a human readable and formatted string such as3:12:45for 3 hours, 12 minutes and 45 seconds? Note also this cannot be 100% accurate as the actual time it takes to write the JSON cannot be integrated, and this could be several seconds on large scans.
Having just seconds would be perfect. I could do formatting myself later.
@pombredanne i would like to work on this feature. Anything I should know that might help me or I should take care of?
@pombredanne even I would love to work on this feature
Hi, I have added the requested feature in the following pull requests: https://github.com/nexB/scancode-toolkit/pull/1939
Now, you can see a 'time_taken' field in the header of the output JSON file,
i guess i need to edit the test cases too since this feature requires direct change in the output JSON file, alot of test cases.
So how should i go dealing with this ? any help is appreciated
@MankaranSingh thank you for this! @armijnhemel do you see this feature as something always present in the JSON scan outputs? Or as guarded by a command line option?
@MankaranSingh let's see if this need to be enabled at all times or not first before updating the tests. There are ways to regenerate test fixtures to help a bit
I think that we can avoid yet another command line option.
I would just always include it.
@MankaranSingh so you will have indeed to update a good bunch of test scan files since they will now contain your new field... On te other hand, since this field will have a different value on each run, it is best excluded from most of the scan tests assertions, except for a few tests focused only on the tests of that feature. Does it make sense? There are very few places where these checks are done, mostly in this place https://github.com/nexB/scancode-toolkit/blob/develop/src/scancode/cli_test_utils.py
ok, on it. So, if i need further help, shall i ask here or on the gitter discussion channel ?
@MankaranSingh best is to keep ticket related discussions on the ticket and you can ask for help in the chat linking to the ticket.
I have opened another pull request https://github.com/nexB/scancode-toolkit/pull/1942 Here are all the changes @pombredanne ok, so all the tests seem to be passing now. What i found out was, that the "start_timestamp" and "end_timestamp" were excluded from the JSON file prior to comparing with the expected JSON file. So, it made sense for me to exclude the new "time_taken" field too !
also, i found no other tests that specifically tested the "start_timestamp" and "end_timestamp", so i too didn't write any other test for the "time_taken" feature.
Also, @armijnhemel, i have updated my commit to store time as float instead of string.
I wish to work on this issue. Is it still available?
I wish to work on this issue. Is it still available?
I suppose it is no longer available, but perhaps @pombredanne can clarify?