Project

General

Profile

Actions

Idea #9514

closed

[API] [Workbench] Delete old container log messages once saved in Keep

Added by Tom Clegg almost 8 years ago. Updated over 7 years ago.

Status:
Resolved
Priority:
Normal
Assigned To:
Radhika Chippada
Category:
API
Target version:
Start date:
06/29/2016
Due date:
Story points:
-
Release:
Release relationship:
Auto

Description

Extend source:services/api/lib/tasks/delete_old_job_logs.rake so rake db:delete_old_job_logs deletes container log entries once they're saved in Keep (currently it only deletes job log entries with event_type="stderr").

In the Workbench container log viewer, detect the case where log entries have been deleted from the logs table, and fetch them from Keep instead.

If fetching them from Keep doesn't work (or is not implemented), rather than showing a mysteriously empty log viewer, show a message acknowledging that the logs aren't shown ("because the container is finished and its logs have been archived"?).


Subtasks 1 (0 open1 closed)

Task #10054: Review branch 9514-only-delete-old-container-logsResolvedPeter Amstutz06/29/2016Actions

Related issues

Related to Arvados - Idea #9407: [Workbench] Implement container log viewer (live + saved) using work unit modelResolvedRadhika Chippada06/27/2016Actions
Actions #1

Updated by Tom Clegg almost 8 years ago

  • Release set to 11
Actions #2

Updated by Radhika Chippada almost 8 years ago

Regarding fetching the log from keep: How about the following?

  • If the log collection is only of 1 block in size, fetch it and display it
  • If the log collection has multiple blocks, fetch only the last block and display it
Actions #3

Updated by Radhika Chippada over 7 years ago

  • Target version set to 2016-09-28 sprint
Actions #4

Updated by Radhika Chippada over 7 years ago

  • Assigned To set to Radhika Chippada
Actions #5

Updated by Radhika Chippada over 7 years ago

  • Status changed from New to In Progress
Actions #6

Updated by Radhika Chippada over 7 years ago

Branch 9514-delete-old-container-logs ready for review at 509f028

  • Added a separate delete_old_container_logs task and tests
  • Moved job related code from log_viewer.js into a separate job_log_viewer.js. Moved previous addToLogViewer code into job_log_viewer and renamed as addToJobLogViewer and converted addToLogViewer to handle generic message display
  • Added log-viewer div and code similar to job log viewer into views/work_units/_show_log.html.erb
  • Added integration tests (couldn’t accomplish it with a controller test due to javascript)
Actions #7

Updated by Peter Amstutz over 7 years ago

Reviewing 509f028

  • (as mentioned in chat) seems like it would be simpler and more efficient to issue a single delete statement, instead of deleting in batches. I checked the log and this is producing statements like:
DELETE FROM "logs" WHERE "logs"."id" IN (139, 141, 142, ... (1000s of ids) ... )
  • I'm not sure the log viewer loading the contents of crunch-run.txt is providing any value. Rather than creeping scope with a bunch of suggestions, maybe we should just disable it for crunch v2 logs until we can give it the attention it deserves. (We can keep the other refactoring.)
Actions #8

Updated by Radhika Chippada over 7 years ago

Branch 9514-only-delete-old-container-logs

"seems like it would be simpler and more efficient to issue a single delete statement ..." :

I was able to do this with pure SQL with using ActiveRecord syntax. Example SQL statement from API server log when the test runs:

 DELETE FROM logs WHERE id in (SELECT logs.id FROM logs JOIN containers ON logs.object_uuid = containers.uuid WHERE event_type IN ('stdout', 'stderr', 'arv-mount', 'crunch-run', 'crunchstat') AND containers.log IS NOT NULL AND containers.finished_at < '2015-09-30 23:34:14 UTC')

"I'm not sure the log viewer loading the contents of crunch-run.txt is providing any value ..." :

In this new branch, only deleting old logs. Updated the #Log for containers to not show the log div in terminal when it is empty

Actions #9

Updated by Radhika Chippada over 7 years ago

Peter: I was able to get the delete operation work with pure SQL, ditching the ActiveRecord syntax. Updated note 8 to reflect that. Thanks for prompting :).

Actions #10

Updated by Peter Amstutz over 7 years ago

Radhika Chippada wrote:

Peter: I was able to get the delete operation work with pure SQL, ditching the ActiveRecord syntax. Updated note 8 to reflect that. Thanks for prompting :).

Much better. LGTM @ f40544f6523bf2d54b288a64af7cab7469741512

Actions #11

Updated by Radhika Chippada over 7 years ago

At e1d958b

Updated the delete_old_job_logs task also to use this better performing SQL. The log statement from API server when tests are run:

DELETE FROM logs WHERE id in (SELECT logs.id FROM logs JOIN jobs ON logs.object_uuid = jobs.uuid WHERE event_type = 'stderr' AND jobs.log IS NOT NULL AND jobs.finished_at < '2015-10-02 14:14:04 UTC')
Actions #12

Updated by Radhika Chippada over 7 years ago

  • Status changed from In Progress to Resolved
  • % Done changed from 0 to 100

Applied in changeset arvados|commit:e0f4124bd0156f7cb029e5330e256086962f9e8e.

Actions

Also available in: Atom PDF