Skip to content

Commit

Permalink
add active ttl (#1486)
Browse files Browse the repository at this point in the history
* add active ttl

* await update status
  • Loading branch information
yehiyam authored Jan 31, 2022
1 parent 4029f61 commit 5b364c6
Show file tree
Hide file tree
Showing 20 changed files with 569 additions and 83 deletions.
108 changes: 96 additions & 12 deletions core/api-server/api/rest-api/swagger.json
Original file line number Diff line number Diff line change
Expand Up @@ -362,11 +362,18 @@
"properties": {
"ttl": {
"type": "integer",
"description": "pipeline time to live in seconds",
"description": "pipeline time to live in seconds (including pending and active states)",
"minimum": 1,
"default": 3600,
"example": 3600
},
"activeTtl": {
"type": "integer",
"description": "pipeline active time to live in seconds (only active state)",
"nullable": true,
"minimum": 1,
"example": 3600
},
"batchTolerance": {
"type": "integer",
"minimum": 0,
Expand Down Expand Up @@ -852,11 +859,18 @@
"properties": {
"ttl": {
"type": "integer",
"description": "pipeline time to live in seconds",
"description": "pipeline time to live in seconds (including pending and active states)",
"minimum": 1,
"default": 3600,
"example": 3600
},
"activeTtl": {
"type": "integer",
"description": "pipeline active time to live in seconds (only active state)",
"nullable": true,
"minimum": 1,
"example": 3600
},
"batchTolerance": {
"type": "integer",
"minimum": 0,
Expand Down Expand Up @@ -2373,11 +2387,18 @@
"properties": {
"ttl": {
"type": "integer",
"description": "pipeline time to live in seconds",
"description": "pipeline time to live in seconds (including pending and active states)",
"minimum": 1,
"default": 3600,
"example": 3600
},
"activeTtl": {
"type": "integer",
"description": "pipeline active time to live in seconds (only active state)",
"nullable": true,
"minimum": 1,
"example": 3600
},
"batchTolerance": {
"type": "integer",
"minimum": 0,
Expand Down Expand Up @@ -2862,11 +2883,18 @@
"properties": {
"ttl": {
"type": "integer",
"description": "pipeline time to live in seconds",
"description": "pipeline time to live in seconds (including pending and active states)",
"minimum": 1,
"default": 3600,
"example": 3600
},
"activeTtl": {
"type": "integer",
"description": "pipeline active time to live in seconds (only active state)",
"nullable": true,
"minimum": 1,
"example": 3600
},
"batchTolerance": {
"type": "integer",
"minimum": 0,
Expand Down Expand Up @@ -8765,11 +8793,18 @@
"properties": {
"ttl": {
"type": "integer",
"description": "pipeline time to live in seconds",
"description": "pipeline time to live in seconds (including pending and active states)",
"minimum": 1,
"default": 3600,
"example": 3600
},
"activeTtl": {
"type": "integer",
"description": "pipeline active time to live in seconds (only active state)",
"nullable": true,
"minimum": 1,
"example": 3600
},
"batchTolerance": {
"type": "integer",
"minimum": 0,
Expand Down Expand Up @@ -9357,11 +9392,18 @@
"properties": {
"ttl": {
"type": "integer",
"description": "pipeline time to live in seconds",
"description": "pipeline time to live in seconds (including pending and active states)",
"minimum": 1,
"default": 3600,
"example": 3600
},
"activeTtl": {
"type": "integer",
"description": "pipeline active time to live in seconds (only active state)",
"nullable": true,
"minimum": 1,
"example": 3600
},
"batchTolerance": {
"type": "integer",
"minimum": 0,
Expand Down Expand Up @@ -9805,11 +9847,18 @@
"properties": {
"ttl": {
"type": "integer",
"description": "pipeline time to live in seconds",
"description": "pipeline time to live in seconds (including pending and active states)",
"minimum": 1,
"default": 3600,
"example": 3600
},
"activeTtl": {
"type": "integer",
"description": "pipeline active time to live in seconds (only active state)",
"nullable": true,
"minimum": 1,
"example": 3600
},
"batchTolerance": {
"type": "integer",
"minimum": 0,
Expand Down Expand Up @@ -10229,11 +10278,18 @@
"properties": {
"ttl": {
"type": "integer",
"description": "pipeline time to live in seconds",
"description": "pipeline time to live in seconds (including pending and active states)",
"minimum": 1,
"default": 3600,
"example": 3600
},
"activeTtl": {
"type": "integer",
"description": "pipeline active time to live in seconds (only active state)",
"nullable": true,
"minimum": 1,
"example": 3600
},
"batchTolerance": {
"type": "integer",
"minimum": 0,
Expand Down Expand Up @@ -10714,11 +10770,18 @@
"properties": {
"ttl": {
"type": "integer",
"description": "pipeline time to live in seconds",
"description": "pipeline time to live in seconds (including pending and active states)",
"minimum": 1,
"default": 3600,
"example": 3600
},
"activeTtl": {
"type": "integer",
"description": "pipeline active time to live in seconds (only active state)",
"nullable": true,
"minimum": 1,
"example": 3600
},
"batchTolerance": {
"type": "integer",
"minimum": 0,
Expand Down Expand Up @@ -11138,11 +11201,18 @@
"properties": {
"ttl": {
"type": "integer",
"description": "pipeline time to live in seconds",
"description": "pipeline time to live in seconds (including pending and active states)",
"minimum": 1,
"default": 3600,
"example": 3600
},
"activeTtl": {
"type": "integer",
"description": "pipeline active time to live in seconds (only active state)",
"nullable": true,
"minimum": 1,
"example": 3600
},
"batchTolerance": {
"type": "integer",
"minimum": 0,
Expand Down Expand Up @@ -20564,11 +20634,18 @@
"properties": {
"ttl": {
"type": "integer",
"description": "pipeline time to live in seconds",
"description": "pipeline time to live in seconds (including pending and active states)",
"minimum": 1,
"default": 3600,
"example": 3600
},
"activeTtl": {
"type": "integer",
"description": "pipeline active time to live in seconds (only active state)",
"nullable": true,
"minimum": 1,
"example": 3600
},
"batchTolerance": {
"type": "integer",
"minimum": 0,
Expand Down Expand Up @@ -20892,11 +20969,18 @@
"properties": {
"ttl": {
"type": "integer",
"description": "pipeline time to live in seconds",
"description": "pipeline time to live in seconds (including pending and active states)",
"minimum": 1,
"default": 3600,
"example": 3600
},
"activeTtl": {
"type": "integer",
"description": "pipeline active time to live in seconds (only active state)",
"nullable": true,
"minimum": 1,
"example": 3600
},
"batchTolerance": {
"type": "integer",
"minimum": 0,
Expand Down
4 changes: 4 additions & 0 deletions core/api-server/tests/mocks/pipelines.json
Original file line number Diff line number Diff line change
Expand Up @@ -95,20 +95,23 @@
{
"nodeName": "green",
"algorithmName": "green-alg",
"kind": "algorithm",
"input": [
"#@flowInput.files.links"
]
},
{
"nodeName": "yellow",
"algorithmName": "yellow-alg",
"kind": "algorithm",
"input": [
"#@flowInput.files.links"
]
},
{
"nodeName": "black",
"algorithmName": "black-alg",
"kind": "algorithm",
"input": [
"#@flowInput.files.links"
]
Expand All @@ -134,6 +137,7 @@
"experimentName": "main",
"options": {
"ttl": 3600,
"activeTtl": 1000,
"batchTolerance": 30,
"progressVerbosityLevel": "debug"
}
Expand Down
21 changes: 21 additions & 0 deletions core/api-server/tests/pipelines-store.js
Original file line number Diff line number Diff line change
Expand Up @@ -392,6 +392,26 @@ describe('Store/Pipelines', () => {
expect(response.body.error.code).to.equal(StatusCodes.BAD_REQUEST);
expect(response.body.error.message).to.equal('debugOverride node not in nodes list');
});
it('should succeed to store pipeline', async () => {
const pipeline = clone(pipelines[2]);
pipeline.name = uuid();
pipeline.description = 'my description';
pipeline.tags = ['bla', 'hot'];
const options = {
uri: restPath,
body: pipeline
};
const response = await request(options);
expect(response.response.statusCode).to.equal(StatusCodes.CREATED);
expect(response.body).to.eql(pipeline);
const storedPipeline = await request({
uri: restPath + '/' + pipeline.name,
method: 'GET'
});
const actual = storedPipeline.body;
delete actual.modified;
expect(actual).to.eql(pipeline);
});
it('should succeed to store pipeline and add defaults', async () => {
const name = uuid();
const options = {
Expand All @@ -414,6 +434,7 @@ describe('Store/Pipelines', () => {
expect(response.body).to.have.property('options');
expect(response.body).to.have.property('priority');
expect(response.body.options).to.have.property('ttl');
expect(response.body.options).to.not.have.property('activeTtl');
expect(response.body.options).to.have.property('batchTolerance');
expect(response.body.options).to.have.property('progressVerbosityLevel');

Expand Down
Loading

0 comments on commit 5b364c6

Please sign in to comment.