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

UI: Log streaming #3564

Merged
merged 25 commits into from
Nov 29, 2017
Merged
Changes from 1 commit
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
3115b34
Guard against null values
DingoEatingFuzz Nov 14, 2017
89ef279
Prefer native fetch
DingoEatingFuzz Nov 14, 2017
50d92af
Add link to the task logs page
DingoEatingFuzz Nov 14, 2017
c87bc96
Add ember-concurrency dependency
DingoEatingFuzz Nov 14, 2017
0d299b6
Provides a slim TextDecoder polyfill for Edge
DingoEatingFuzz Nov 14, 2017
5735fca
Log class for interfacing with log APIs
DingoEatingFuzz Nov 14, 2017
72d84f6
First pass at the logs page
DingoEatingFuzz Nov 14, 2017
20ac6c0
Move logging logic from the controller to a component
DingoEatingFuzz Nov 15, 2017
5c8ba29
New icons for pausing and playing
DingoEatingFuzz Nov 15, 2017
efc3b53
Updated styles for the cli-window component
DingoEatingFuzz Nov 15, 2017
b3abd78
Let the log component fill all available height
DingoEatingFuzz Nov 15, 2017
0faacf2
New eslint rule for ember-concurrency infinite loop pattern
DingoEatingFuzz Nov 15, 2017
80e9254
Microscopic refactor for style reasons
DingoEatingFuzz Nov 15, 2017
f283287
Prevent using fetch or ReadableStream in tests
DingoEatingFuzz Nov 16, 2017
37653a9
Crude log mocking
DingoEatingFuzz Nov 16, 2017
249d2a3
Acceptance tests for task logs
DingoEatingFuzz Nov 16, 2017
0193e05
Rename allocation-log to task-log
DingoEatingFuzz Nov 16, 2017
2926920
Add CORS headers to client fs endpoints
DingoEatingFuzz Nov 16, 2017
0dce1ec
Integration tests for the task-log component
DingoEatingFuzz Nov 17, 2017
a822849
Fixes intermittent test failures
DingoEatingFuzz Nov 17, 2017
6447785
Use offset numbers in the polling mechanism
DingoEatingFuzz Nov 18, 2017
bc3f02b
Use the b64 log format to track offsets for pause/play support
DingoEatingFuzz Nov 21, 2017
d930180
Unit tests for the log util
DingoEatingFuzz Nov 21, 2017
cca4bc9
Move the stream support check to the stream logger
DingoEatingFuzz Nov 21, 2017
981c34b
Explain the magical logging constant
DingoEatingFuzz Nov 21, 2017
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Crude log mocking
This will need to get better for testing the offset stitching
logic in the polling case.
DingoEatingFuzz committed Nov 21, 2017
commit 37653a95c3e80bd6a45106dd953f85346af3cc9b
19 changes: 19 additions & 0 deletions ui/mirage/config.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import Ember from 'ember';
import Response from 'ember-cli-mirage/response';
import { HOSTS } from './common';
import { logFrames, logEncode } from './data/logs';

const { copy } = Ember;

@@ -166,6 +167,24 @@ export default function() {
this.get(`http://${host}/v1/client/stats`, function({ clientStats }) {
return this.serialize(clientStats.find(host));
});

this.get(`http://${host}/v1/client/fs/logs/:allocation_id`, function(
server,
{ params, queryParams }
) {
const allocation = server.allocations.find(params.allocation_id);
const groups = server.taskGroups.findBy({ jobId: allocation.jobId });

if (!groups.mapBy('name').includes(queryParams.task)) {
return new Response(400, {}, 'must include task name');
}

if (queryParams.plain) {
return logFrames.join('');
}

return logEncode(logFrames, logFrames.length - 1);
});
});
}

16 changes: 16 additions & 0 deletions ui/mirage/data/logs.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
export const logFrames = [
'hello world\n',
'some more output\ngoes here\n\n--> potentially helpful',
' hopefully, at least.\n',
];

export const logEncode = (frames, index) => {
return frames
.slice(index)
.map(frame => window.btoa(frame))
.map((frame, innerIndex) => {
const offset = frames.slice(innerIndex).reduce((sum, frame) => sum + frame.length, 0);
return JSON.stringify({ Offset: offset, Data: frame });
})
.join('');
};