New collumn of execution time added in db schema of oc_jobs#27144
New collumn of execution time added in db schema of oc_jobs#27144PVince81 merged 17 commits intoowncloud:masterfrom
Conversation
|
This will likely not be enough. In past ownCloud versions, the XML file was the authority regarding database schemas. Have a look how it's done here: https://github.com/owncloud/core/blob/master/core/Migrations/Version20170111103310.php#L9. Let me know if you need assistance. Once this is done the next step is to adjust the background job runner to measure the execution time and put it there. |
|
@PVince81 , thanks for the quick review, I'll look into it as soon as possible. |
|
@PVince81 , please check now, I completed making another column in oc_jobs table named execution time through migration. |
tests/lib/DB/schemDiffData/core.xml
Outdated
| <notnull>false</notnull> | ||
| </field> | ||
|
|
||
| <field> |
| <notnull>false</notnull> | ||
| </field> | ||
|
|
||
| <field> |
There was a problem hiding this comment.
@DeepDiver1975 ,
So I shouldn't add the new column of execution_duration in oc_jobs table's schema of the tests?
|
@noveens THx - next would be to fill the columns 😉 |
|
@DeepDiver1975 , does that come in the scope of this bug? |
|
@noveens yes, because else the column is completely useless. Do you need pointers ? |
|
@PVince81, pointers would be a great way to start. |
|
The job is executed here: https://github.com/owncloud/core/blob/master/cron.php#L122 I suggest you add statements around here https://github.com/owncloud/core/blob/master/lib/private/BackgroundJob/Job.php#L52 to measure the running time. Then store the value in the database. For storing, use something like https://github.com/owncloud/core/blob/master/lib/private/BackgroundJob/JobList.php#L307. Maybe a new method |
|
@PVince81 , I have made the new method, but how to check the changes I have made? Update: Pushed the changes I made, please review @DeepDiver1975 |
| public function setExecutionTime($job, $timeTaken) { | ||
| $query = $this->connection->getQueryBuilder(); | ||
| $query->update('jobs') | ||
| ->set('last_run', $query->createNamedParameter($timeTaken, IQueryBuilder::PARAM_INT)) |
There was a problem hiding this comment.
sorry, bad mistake :p
|
@noveens please have a look at my comment. To test this you can run Then run cron.php again and see if your new column is populated. |
|
@PVince81 , please recheck |
|
Code looks good so far. Thanks. Will test it later. |
|
I tested it but after running cron.php I see the last_run being populated, but the value of "execution_duration" is always 0. Even if my computer is too fast, I'd still expect values of at least a few millisecond. Wanted to test it with LDAP (which provides ways to have slower jobs) but the app is broken at the moment: #27154 |
|
@PVince81 , Hence I chose this approach. |
|
|
Tested with LDAP. I saw cron.php taking a minute or so, still the column "execution_duration" contains only zeroes. How did you test it? |
|
@PVince81 , It would be great if you could tell me how to test this. |
|
Told you here: #27144 (comment) The table is already pre-populated by default recurring jobs after setting up OC. |
|
@bantu, @tanghus, @butonic, @DeepDiver1975 and @PVince81 , I managed to pass Jenkins now ( took 1h 42m :p ) please have a look and review this PR. |
|
Revert the permission change in the config.sample.php file please. |
I tested the PR in the same way.
👍 IMHO A small enhancement when running a job without arguments will be to not print the with arguments: text |
|
@jvillafanez , |
|
@jvillafanez , |
|
@DeepDiver1975 , |
|
I don't have anything more to add 👍 |
|
@PVince81 , |
|
@DeepDiver1975 can you kick Jenkins to retest this ? |
|
@PVince81 , |
|
Added to new features page: https://github.com/owncloud/core/wiki/ownCloud-10.0-Features |
|
@PVince81 @DeepDiver1975 Backport the logging part? I think it could be quite useful and not intrusive. DB changes won't be backported. |
|
Yes, please backport the logging part. @noveens can you do it ? Basically create a branch off "stable9.1", put your commits there then submit a PR that targets stable9.1. Only put the logging part there. |
|
@PVince81 , |
|
Nothing to update here. Make a new branch. |
[Stable9.1] Backporting logging changes of PR #27144
|
stable9.1 logging changes backport: #27239 |
|
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. |


Description
I have changed the schema of the db_structure.xml file and the corresponding tests where oc_jobs was concerned.
I added a column of execution duration in the oc_jobs table.
Related Issue
#27137
Motivation and Context
This is a new feature which could help in testing of the system.
How Has This Been Tested?
I have tested this thoroughly, even edited one of the tests because of the database migration.
Screenshots (if appropriate):
Not necessary.
Types of changes
Checklist: