Skip to content

Commit 6ca7ebc

Browse files
authored
Is/stop pipeline (#1879)
implemented cancellation of tasks added ABORTED in API added stop button in GUI add REGISTRY_PATH environ variable, essentially for testing purpose add redis in celery
1 parent 216a09b commit 6ca7ebc

File tree

85 files changed

+2018
-937
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

85 files changed

+2018
-937
lines changed

.env-devel

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ POSTGRES_PORT=5432
1414
POSTGRES_USER=scu
1515

1616
RABBIT_HOST=rabbit
17-
RABBIT_CHANNELS={"log": "comp.backend.channels.log", "instrumentation": "comp.backend.channels.instrumentation", "celery": {"result_backend": "redis://redis:6379/0"}}
17+
RABBIT_CHANNELS={"log": "comp.backend.channels.log", "instrumentation": "comp.backend.channels.instrumentation"}
1818
RABBIT_PASSWORD=adminadmin
1919
RABBIT_PORT=5672
2020
RABBIT_USER=admin

api/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
# Concept
44

5-
Common REST API specifications and models (defined as openAPI- or JSON-schemas) are defined in a central location [``api/specs``](api/specs) to allow for **design-first development**.
5+
Common REST API specifications and models (defined as openAPI- or JSON-schemas) are defined in a central location [``api/specs``](/api/specs) to allow for **design-first development**.
66

77
# Standards
88

@@ -67,7 +67,7 @@ In that case, a version subfolder shall be added in the __/common/__ subfolder a
6767
Mixing [JSONSchema] with OpenAPI schema needs some additional steps:
6868

6969
1. Define the [JSONSchema] schema.
70-
2. Convert the [JSONSchema] formatted file to OpenAPI formatted file using a [converter](scripts/json-schema-to-openapi-schema) tool.
70+
2. Convert the [JSONSchema] formatted file to OpenAPI formatted file using a [converter](/scripts/json-schema-to-openapi-schema) tool.
7171
3. In the openapi specifications file ref the converted OpenAPI schema file
7272

7373
This is automated in the makefiles as dependencies

api/specs/common/schemas/project-v0.0.1-converted.yaml

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ properties:
7373
workbench:
7474
type: object
7575
x-patternProperties:
76-
^\S+$:
76+
^\d+$:
7777
type: object
7878
additionalProperties: false
7979
required:
@@ -227,8 +227,14 @@ properties:
227227
properties:
228228
x:
229229
type: integer
230+
description: The x position
231+
example:
232+
- '12'
230233
'y':
231234
type: integer
235+
description: The y position
236+
example:
237+
- '15'
232238
deprecated: true
233239
state:
234240
title: RunningState
@@ -242,6 +248,7 @@ properties:
242248
- RETRY
243249
- SUCCESS
244250
- FAILURE
251+
- ABORTED
245252
type: string
246253
additionalProperties: true
247254
ui:
@@ -266,8 +273,14 @@ properties:
266273
properties:
267274
x:
268275
type: integer
276+
description: The x position
277+
example:
278+
- '12'
269279
'y':
270280
type: integer
281+
description: The y position
282+
example:
283+
- '15'
271284
additionalProperties: true
272285
slideshow:
273286
type: object
@@ -359,6 +372,7 @@ properties:
359372
- RETRY
360373
- SUCCESS
361374
- FAILURE
375+
- ABORTED
362376
type: string
363377
required:
364378
- value

api/specs/common/schemas/project-v0.0.1.json

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -342,7 +342,8 @@
342342
"STARTED",
343343
"RETRY",
344344
"SUCCESS",
345-
"FAILURE"
345+
"FAILURE",
346+
"ABORTED"
346347
],
347348
"type": "string"
348349
}
@@ -515,7 +516,8 @@
515516
"STARTED",
516517
"RETRY",
517518
"SUCCESS",
518-
"FAILURE"
519+
"FAILURE",
520+
"ABORTED"
519521
],
520522
"type": "string"
521523
}

api/specs/webserver/openapi-services.yaml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,20 @@ paths:
1616
$ref: "./components/schemas/pipeline.yaml#/components/schemas/PipelineCreatedEnveloped"
1717
default:
1818
$ref: "#/components/responses/DefaultErrorResponse"
19+
20+
/computation/pipeline/{project_id}/stop:
21+
post:
22+
description: Stops a pipeline of a given project
23+
tags:
24+
- service
25+
operationId: stop_pipeline
26+
parameters:
27+
- $ref: "#/components/parameters/ProjectId"
28+
responses:
29+
"204":
30+
description: Succesffully stopped the pipeline
31+
default:
32+
$ref: "#/components/responses/DefaultErrorResponse"
1933
# PROJECT SERVICES -----------------------------------------------------------------
2034
components:
2135
parameters:

api/specs/webserver/openapi.yaml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -139,8 +139,10 @@ paths:
139139
$ref: "./openapi-storage.yaml#/paths/~1storage~1locations~1{location_id}~1datasets"
140140

141141
# SERVICES ------------------------------------------------------------------------
142-
/computation/pipeline/{project_id}/start:
142+
/computation/pipeline/{project_id}:start:
143143
$ref: "./openapi-services.yaml#/paths/~1computation~1pipeline~1{project_id}~1start"
144+
/computation/pipeline/{project_id}:stop:
145+
$ref: "./openapi-services.yaml#/paths/~1computation~1pipeline~1{project_id}~1stop"
144146

145147
# PROJECT SERVICES -----------------------------------------------------------------
146148

ci/github/integration-testing/webserver.bash

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -8,27 +8,28 @@ DOCKER_IMAGE_TAG=$(exec ci/helpers/build_docker_image_tag.bash)
88
export DOCKER_IMAGE_TAG
99

1010
install() {
11-
bash ci/helpers/ensure_python_pip.bash
12-
pushd services/web/server; pip3 install -r requirements/ci.txt; popd;
13-
pip list -v
14-
make pull-version || ( (make pull-cache || true) && make build-x tag-version)
15-
make info-images
11+
bash ci/helpers/ensure_python_pip.bash
12+
pushd services/web/server
13+
pip3 install -r requirements/ci.txt
14+
popd
15+
pip list -v
16+
make pull-version || ( (make pull-cache || true) && make build-x tag-version)
17+
make info-images
1618
}
1719

1820
test() {
19-
pytest --cov=simcore_service_webserver --durations=10 --cov-append \
20-
--color=yes --cov-report=term-missing --cov-report=xml --cov-config=.coveragerc \
21-
-v -m "not travis" services/web/server/tests/integration
21+
pytest --cov=simcore_service_webserver --durations=10 --cov-append \
22+
--color=yes --cov-report=term-missing --cov-report=xml --cov-config=.coveragerc \
23+
-v -m "not travis" services/web/server/tests/integration --log-level=DEBUG
2224
}
2325

2426
clean_up() {
25-
docker images
26-
make down
27+
docker images
28+
make down
2729
}
2830

2931
# Check if the function exists (bash specific)
30-
if declare -f "$1" > /dev/null
31-
then
32+
if declare -f "$1" >/dev/null; then
3233
# call arguments verbatim
3334
"$@"
3435
else
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
from pydantic import BaseSettings, PositiveInt
2+
from .redis import RedisConfig
3+
from .rabbit import RabbitConfig
4+
5+
6+
class CeleryConfig(BaseSettings):
7+
@classmethod
8+
def create_from_env(cls) -> "CeleryConfig":
9+
# this calls trigger env parsers
10+
return cls(rabbit=RabbitConfig(), redis=RedisConfig())
11+
12+
rabbit: RabbitConfig = RabbitConfig()
13+
redis: RedisConfig = RedisConfig()
14+
task_name: str = "simcore.comp.task"
15+
publication_timeout: PositiveInt = 60
16+
17+
@property
18+
def broker_url(self):
19+
return self.rabbit.dsn
20+
21+
@property
22+
def result_backend(self):
23+
return self.redis.dsn

packages/models-library/src/models_library/projects.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ class RunningState(str, Enum):
2525
RETRY = "RETRY"
2626
SUCCESS = "SUCCESS"
2727
FAILURE = "FAILURE"
28+
ABORTED = "ABORTED"
2829

2930

3031
class PortLink(BaseModel):
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
from typing import Dict, Optional
2+
3+
from pydantic import BaseSettings, Extra, validator
4+
from pydantic.networks import AnyUrl
5+
from pydantic.types import PositiveInt, SecretStr
6+
7+
8+
class RabbitDsn(AnyUrl):
9+
allowed_schemes = {"amqp"}
10+
11+
12+
class RabbitConfig(BaseSettings):
13+
# host
14+
host: str = "rabbit"
15+
port: PositiveInt = 5672
16+
17+
# auth
18+
user: str = "simcore"
19+
password: SecretStr = SecretStr("simcore")
20+
21+
dsn: Optional[RabbitDsn] = None
22+
23+
# channels
24+
channels: Dict[str, str] = {
25+
"log": "comp.backend.channels.log",
26+
"instrumentation": "comp.backend.channels.instrumentation",
27+
}
28+
29+
@validator("dsn", pre=True)
30+
@classmethod
31+
def autofill_dsn(cls, v, values):
32+
if v is None:
33+
return RabbitDsn.build(
34+
scheme="amqp",
35+
user=values["user"],
36+
password=values["password"].get_secret_value(),
37+
host=values["host"],
38+
port=f"{values['port']}",
39+
)
40+
return v
41+
42+
class Config:
43+
env_prefix = "RABBIT_"
44+
extra = Extra.forbid

0 commit comments

Comments
 (0)