Skip to content

Export group #1266

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

Merged
merged 568 commits into from
Mar 16, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
568 commits
Select commit Hold shift + click to select a range
a6b3c20
Added catalog OAS
Feb 11, 2020
03124d2
Removed copy openapi to web client
Feb 11, 2020
bf12aa4
Added catalog setup in app
Feb 11, 2020
ef84609
Added function to create openapi specs doc
Feb 11, 2020
0199dbf
Added entry in makefile
Feb 11, 2020
5bf58a0
Merge branch 'master' into feature/export-group
odeimaiz Feb 12, 2020
278f767
bad merge
odeimaiz Feb 12, 2020
112579b
Adds to check to ensure venv is active and avoid installing in system…
Feb 12, 2020
9bca4eb
fixes link binding bug
odeimaiz Feb 12, 2020
dd761d2
Label in NodesTree bound to Node model
odeimaiz Feb 12, 2020
2294529
Access to functionality
Feb 12, 2020
767727d
Adds load default configuration
Feb 12, 2020
23b8baf
Created tests for catalog setup (still do not pass)
Feb 12, 2020
4e35f4c
Tests catalog w/ db
Feb 12, 2020
3f7f638
Added all target in api/tests makefile
Feb 12, 2020
4674625
Merge branch 'master' into is1273/groups-api
Feb 12, 2020
642f2ed
Fixes forward call/response
Feb 12, 2020
f5cdc7f
Implements catalog get_dag endpoint and raise not implemented properly
Feb 12, 2020
8bd68d5
Fixes responses in non-json
Feb 12, 2020
a34f746
Minor
Feb 12, 2020
a7885cb
Fixes catalog version
Feb 13, 2020
4be1143
Merge branch 'master' into is1273/groups-api
Feb 13, 2020
cfb2430
Fixes fixture
Feb 13, 2020
c07d058
Makefile: keep TODO.md when cleaning
Feb 13, 2020
d06482e
Adds catalog to github CI
Feb 13, 2020
7da9d94
Minor
Feb 13, 2020
9959399
Added travis CI config
Feb 13, 2020
bd084e7
Merge branch 'master' into feature/export-group
odeimaiz Feb 13, 2020
542fa2e
Merge branch 'master' into feature/export-group
odeimaiz Feb 13, 2020
0043f07
Merge pull request #55 from pcrespov/is1273/groups-api
odeimaiz Feb 13, 2020
35a6204
Organize tags in webserver API
Feb 13, 2020
4c6c41d
webserver api version: 0.2.1 → 0.2.2
Feb 13, 2020
ee084b2
Reordered tags so doc (at /api/doc) is more readable
Feb 13, 2020
90fa40b
webserver api version: 0.2.2 → 0.3.0
Feb 13, 2020
c09ae92
Document API
Feb 13, 2020
6bec098
Merge remote-tracking branch 'upstream/master' into is1273/groups-api
Feb 13, 2020
09c8fe0
Cleanup webserver rest subsystem
Feb 13, 2020
d70c073
"/groups" -> "/catalog/dags"
odeimaiz Feb 13, 2020
32f0930
using backend for storing groups + UX
odeimaiz Feb 13, 2020
05c303b
Updated catalog front-end API section
Feb 13, 2020
321732c
WIP testing
Feb 13, 2020
2db2dea
webserver api version: 0.3.0 → 0.3.1
Feb 13, 2020
820183e
Assigned catalog ownership to pcrespov
Feb 13, 2020
e6770f3
Merge branch 'feature/export-group' into is1273/groups-api
odeimaiz Feb 14, 2020
4615c6d
Merge pull request #56 from pcrespov/is1273/groups-api
odeimaiz Feb 14, 2020
c35e31b
Adding remote debugging module
Feb 14, 2020
35f3c07
Adding app identifier that accounts session
Feb 14, 2020
ff20f0d
remote debug and pg cmd fix:
Feb 14, 2020
417a1d5
Clean install-* recipe
Feb 14, 2020
c1c2b98
Adds logging configuration
Feb 14, 2020
8297848
Cleanup
Feb 14, 2020
87c68fb
delete macros
odeimaiz Feb 14, 2020
f7a7dc4
clean-venv: a new recipe to cleanup .venv installation
Feb 14, 2020
e56765f
Clean dependencies
Feb 15, 2020
d93d413
Fixes execution in boot
Feb 15, 2020
a0c9b0b
Minor fix.
Feb 15, 2020
382c662
Cleanup
Feb 15, 2020
95ef797
Minor cleanup main, docker, entrypoints and db
Feb 15, 2020
4824050
Merge branch 'pcrespov-is1273/groups-api' into feature/export-group
odeimaiz Feb 17, 2020
e7c0b15
send group in post body-data
odeimaiz Feb 17, 2020
6e65107
Fixes project schema
Feb 17, 2020
315572d
Merge branch 'pcrespov-is1273/groups-api' into feature/export-group
odeimaiz Feb 17, 2020
e1249c5
delete call fixed
odeimaiz Feb 17, 2020
4eb3723
minor
odeimaiz Feb 17, 2020
2c4a343
Delete dag working
odeimaiz Feb 17, 2020
87e6db2
minor
odeimaiz Feb 17, 2020
c815162
using FetchButton
odeimaiz Feb 17, 2020
0e15ccb
Maintenance: improves clean target
Feb 17, 2020
aa3009d
Fixes inputAccess
Feb 17, 2020
998fc4d
Fixes from cookiecutter
Feb 17, 2020
16933d9
WIP: Setting up properly tests.
Feb 17, 2020
b661670
Merge branch 'pcrespov-is1273/groups-api' into feature/export-group
odeimaiz Feb 18, 2020
9b3944c
minor
odeimaiz Feb 18, 2020
720fa51
minor
odeimaiz Feb 18, 2020
e245efb
minor
odeimaiz Feb 18, 2020
f14ba03
HACK
odeimaiz Feb 19, 2020
b71e473
Avoids nested connections
Feb 19, 2020
bc2226d
minor
odeimaiz Feb 19, 2020
d37541a
HACK also wait for deleting
odeimaiz Feb 19, 2020
63abb14
Avoids inner async loop bug in loadprojects
Feb 19, 2020
5b8fc4d
Minor
Feb 19, 2020
38f5b25
Confirmation window added
odeimaiz Feb 19, 2020
38211f2
Maintenance: improves clean
Feb 15, 2020
24f39c9
Ask for confirmation for deleting groups
odeimaiz Feb 19, 2020
62c54de
Merge branch 'fix/blocking' of git://github.com/pcrespov/osparc-simco…
odeimaiz Feb 19, 2020
0a96cbe
Cleanup
Feb 19, 2020
aa57948
Fixes tags assignement (thx Odei!)
Feb 19, 2020
8f490d5
Merge branch 'fix/blocking' of git://github.com/pcrespov/osparc-simco…
odeimaiz Feb 19, 2020
e482606
Merge remote-tracking branch 'upstream/master' into is1273/groups-api
Feb 19, 2020
e3622d3
Removed commented code
Feb 19, 2020
a600f7d
Fixes bandit issues and cleanup
Feb 19, 2020
c00baeb
Removed dummy data
Feb 19, 2020
eca7d60
Cleanup format with black
Feb 19, 2020
8068bec
Merge branch 'master' into is1273/groups-api
Feb 19, 2020
f7cb881
updated openapi doc
Feb 19, 2020
8ca9c18
Maintenance: Adds bump2version as dev tools
Feb 19, 2020
ebed18e
Bump version: 0.1.0 → 0.2.0
Feb 19, 2020
2715a6e
Started generic utils module
Feb 19, 2020
588e905
new table to database
Feb 19, 2020
a31e013
Added simcore-postgres-database library
Feb 19, 2020
4f6e4a7
Gets orm from package
Feb 19, 2020
fba0684
Some extra fixes
Feb 19, 2020
de2ac9d
Fixes path in ci requirements.
Feb 19, 2020
09d9e32
Adds general tools dependencies in _test.in
Feb 19, 2020
6897fe5
Adds Makefile to dev postgres-package
Feb 19, 2020
286108b
Add script linter tool
pcrespov Feb 20, 2020
09d822b
Merge branch 'is1273/groups-api' of github.com:pcrespov/osparc-simcor…
pcrespov Feb 20, 2020
a9c5ee4
undoing HACK
odeimaiz Feb 20, 2020
41fdd12
Merge branch 'is1273/groups-api' of git://github.com/pcrespov/osparc-…
odeimaiz Feb 20, 2020
c5cf55f
bad merge
odeimaiz Feb 20, 2020
4307082
minor
odeimaiz Feb 20, 2020
398b003
renamed crud->storage and removed dummy schemas
Feb 20, 2020
a5bdaa9
cleanup
Feb 20, 2020
0b0f25c
Adding some tests for schemas
Feb 20, 2020
eeb7a80
Merge branch 'is1273/groups-api' of github.com:pcrespov/osparc-simcor…
Feb 20, 2020
eb98790
Fixes tests
Feb 20, 2020
ac2d36b
Formatting and doc
Feb 20, 2020
539f335
Fixes build and extends makefile
Feb 20, 2020
3c250b6
Upgrades dev status in classifiers
Feb 20, 2020
75f65b3
Merge branch 'is1273/groups-api' of git://github.com/pcrespov/osparc-…
odeimaiz Feb 20, 2020
9406562
upgrade
Feb 20, 2020
87ade95
Bump version: 0.2.0 → 0.3.0
Feb 20, 2020
915fdb3
Adds openapi as well
Feb 20, 2020
71af2aa
adds update on openapi.yaml
Feb 20, 2020
d192d5e
Bump version: 0.3.0 → 0.3.1
Feb 20, 2020
7f10092
sc-pg needs a mechanism to fill metadata superclass by gather all models
Feb 20, 2020
07da2e8
scpg: new recipe to create migration reviews
Feb 20, 2020
decb3da
New commit to migration
Feb 20, 2020
275a03a
Minor
Feb 20, 2020
b4bbdf9
minor
Feb 20, 2020
e842065
Recipe to autoformat
Feb 20, 2020
34b7e4c
scpg auto formatted with black
Feb 20, 2020
8d0de4c
Updates catalog versino setup
Feb 20, 2020
113807e
Adds setup for versioning to scpg
Feb 20, 2020
78ba12b
packages/postgres-database version: 0.1.0 → 0.2.0
Feb 20, 2020
ed81070
updates versioning of scpg dependencies
Feb 20, 2020
78ff891
services/catalog version: 0.3.1 → 0.3.2
Feb 20, 2020
0bf141f
Fix mispell
Feb 20, 2020
a502211
Fixes catalog tests in webserver
Feb 20, 2020
2d9b5a6
Formatted with black
Feb 20, 2020
2633b25
Makefile: adds recipes in webserver
Feb 20, 2020
3a493f8
Adds access to catalog
Feb 20, 2020
8a2e672
Fixes pylint error
Feb 20, 2020
e1fd7f0
Minor
Feb 20, 2020
4e03722
Created catalog.utils
Feb 20, 2020
bee916d
Shorten catalog storage->store module
Feb 20, 2020
40dfcf6
Fixes swarm-deploy system testing
Feb 20, 2020
9ecc1a5
Fixes main entrypoint in catalog service
Feb 20, 2020
1cd00c0
Fixes catalog docker in production
Feb 20, 2020
f3e91ff
Fixes typo
Feb 21, 2020
8e5d086
Fixes on code coverage actions
Feb 21, 2020
fb90143
Reverted names
Feb 21, 2020
1c26a6c
typo
odeimaiz Feb 21, 2020
b713528
Merge branch 'is1273/groups-api' of git://github.com/pcrespov/osparc-…
odeimaiz Feb 21, 2020
60dbedc
Minor
Feb 21, 2020
dcb9f99
Merge branch 'is1273/groups-api' of git://github.com/pcrespov/osparc-…
odeimaiz Feb 21, 2020
334afd3
Adds settings for shellcheck extension
Feb 21, 2020
0bd6bd7
Corrected catalog shell scripts
Feb 21, 2020
64b8b6e
Fixes correct restart of catalog app
Feb 21, 2020
1506acd
Merge branch 'master' into is1273/groups-api
Feb 21, 2020
0c44562
Merge branch 'master' into feature/export-group
odeimaiz Feb 24, 2020
22f0146
Remove errro in index.html
odeimaiz Feb 24, 2020
d95a117
Fixing boot in dev mode
Feb 24, 2020
71565af
Merge branch 'is1273/groups-api' of git://github.com/pcrespov/osparc-…
odeimaiz Feb 24, 2020
e950eb1
Minor
Feb 24, 2020
4fe4056
Fixes unused variable
Feb 24, 2020
819ef19
Merge branch 'is1273/groups-api' of git://github.com/pcrespov/osparc-…
odeimaiz Feb 24, 2020
15e4ef8
Fixes wrong pipes in entrypoint scripts
Feb 24, 2020
0918709
Merge branch 'is1273/groups-api' of git://github.com/pcrespov/osparc-…
odeimaiz Feb 24, 2020
849b205
getValues moved to base class
odeimaiz Feb 24, 2020
aa68e6c
Merge branch 'master' into feature/export-group
odeimaiz Feb 24, 2020
4a986b0
getInputEditorValues added
odeimaiz Feb 24, 2020
725e57b
take inputEditorValues from form
odeimaiz Feb 24, 2020
7d22051
Merge branch 'feature/export-group' of github.com:odeimaiz/osparc-sim…
odeimaiz Feb 24, 2020
de74191
"Edit Access Level" only for "users"
odeimaiz Feb 24, 2020
d699730
hacks removed
odeimaiz Feb 24, 2020
a6de2dc
cleanup
odeimaiz Feb 24, 2020
d8a9a4a
minor
odeimaiz Feb 24, 2020
50bea86
smaller icon
odeimaiz Feb 25, 2020
d4de9bd
Merge branch 'master' into feature/export-group
pcrespov Feb 26, 2020
f81937d
Merge branch 'master' into feature/export-group
odeimaiz Feb 27, 2020
a87fa75
groups added to properties
odeimaiz Feb 27, 2020
62be9bb
catch after then
odeimaiz Feb 27, 2020
65b1fce
@ignapas reviews
odeimaiz Feb 27, 2020
50b18f6
reapply filters after rebuilding list
odeimaiz Feb 27, 2020
1dc5ffd
Merge branch 'master' into feature/export-group
odeimaiz Mar 5, 2020
10792fb
Documentation added
odeimaiz Mar 5, 2020
c22794a
groupName is really required
odeimaiz Mar 5, 2020
920c031
Merge branch 'master' into feature/export-group
odeimaiz Mar 6, 2020
aa578ed
reapplying logic simplified
odeimaiz Mar 6, 2020
21e0afa
Just moved reapply to the filter group and renamed it to dispatch to …
ignapas Mar 6, 2020
5b8669b
Added actions toolbar to export dialog
ignapas Mar 6, 2020
b850298
Merge pull request #57 from ignapas/odeimaiz-feature/export-group
odeimaiz Mar 9, 2020
ca6ea36
Merge branch 'master' into feature/export-group
odeimaiz Mar 9, 2020
2111222
Merge branch 'master' into feature/export-group
odeimaiz Mar 9, 2020
d192c9c
Merge branch 'master' into feature/export-group
odeimaiz Mar 9, 2020
34cda72
Merge branch 'master' into feature/export-group
odeimaiz Mar 11, 2020
dd7a111
minor
odeimaiz Mar 11, 2020
989aabf
added restart button to the iframe
odeimaiz Mar 11, 2020
6fdf49f
minor fix
odeimaiz Mar 11, 2020
759760e
Added retrieve button to group node view containing at least one dyna…
odeimaiz Mar 11, 2020
07d1246
Merge branch 'master' into feature/export-group
odeimaiz Mar 11, 2020
e90e5ad
restart button goes on the iFrame
odeimaiz Mar 11, 2020
21a5eca
restartIFrameButton moved away from Node
odeimaiz Mar 11, 2020
2634381
Merge branch 'master' into feature/export-group
odeimaiz Mar 12, 2020
fa5be1d
print output in e2e testing
odeimaiz Mar 12, 2020
d19126d
check also services/dags
odeimaiz Mar 12, 2020
8347494
print responses
odeimaiz Mar 12, 2020
4b83e8d
check if error is not null in response
odeimaiz Mar 12, 2020
6a428ae
minor
odeimaiz Mar 12, 2020
10ea39d
Merge branch 'master' into feature/export-group
odeimaiz Mar 12, 2020
49e148e
minor
odeimaiz Mar 12, 2020
7e50993
Merge branch 'feature/export-group' of github.com:odeimaiz/osparc-sim…
odeimaiz Mar 12, 2020
f5e54b9
better verbose
odeimaiz Mar 12, 2020
b4ca4d9
Merge branch 'master' into feature/export-group
odeimaiz Mar 12, 2020
767a43d
minor
odeimaiz Mar 12, 2020
a67c742
fix e2e
odeimaiz Mar 12, 2020
0765b1a
Merge branch 'feature/export-group' of github.com:odeimaiz/osparc-sim…
odeimaiz Mar 12, 2020
12c3487
Merge branch 'master' into feature/export-group
odeimaiz Mar 12, 2020
d54ba37
fix e2e
odeimaiz Mar 12, 2020
cb9be3f
Merge branch 'feature/export-group' of github.com:odeimaiz/osparc-sim…
odeimaiz Mar 12, 2020
ea17b1d
more logs
odeimaiz Mar 12, 2020
7733d83
LogLevel = Debug
odeimaiz Mar 13, 2020
c27b5f6
Adds e2e outputs to ignore list
Mar 13, 2020
f63bfac
Fixes typo in LOG_LEVEL environ
Mar 13, 2020
816cf5e
Adds stack config to artifacts
Mar 13, 2020
3c7c5c1
Merge pull request #59 from pcrespov/odeimaiz-feature/export-group
odeimaiz Mar 13, 2020
23f8a88
minor
odeimaiz Mar 13, 2020
3d15424
show request method
odeimaiz Mar 13, 2020
39a7afc
Testing init tables from catalog service
Mar 13, 2020
d9a5a36
cleanup
odeimaiz Mar 13, 2020
5a0b713
Fixes test in storage
Mar 13, 2020
9dedbc0
Undoes tmp fix in catalog environs
Mar 13, 2020
4808269
Remove tables initiazliation
Mar 13, 2020
08b79ed
Adds missing requirements in pg db
Mar 13, 2020
64f5fbb
Adds migration step in test/e2e workflow
Mar 13, 2020
45350b8
minor
odeimaiz Mar 13, 2020
1001abe
fixes #1364
odeimaiz Mar 13, 2020
6b39c78
Fixes tests failure
Mar 13, 2020
7f99cfe
Fixes director tests
Mar 13, 2020
582a14e
Fixes e2e testing installation problem
Mar 13, 2020
770675f
Fixes installation of pg in e2e testing
Mar 13, 2020
0885496
increased log level.
Mar 13, 2020
1eea813
Merge pull request #60 from pcrespov/odeimaiz-feature/export-group
odeimaiz Mar 16, 2020
af6ccd0
Merge branch 'master' into feature/export-group
odeimaiz Mar 16, 2020
851a228
Merge branch 'master' into feature/export-group
odeimaiz Mar 16, 2020
0317d3d
Merge branch 'master' into feature/export-group
odeimaiz Mar 16, 2020
b413bf3
minor
odeimaiz Mar 16, 2020
93c1e45
Merge branch 'feature/export-group' of github.com:odeimaiz/osparc-sim…
odeimaiz Mar 16, 2020
86ff81e
Merge branch 'master' into feature/export-group
odeimaiz Mar 16, 2020
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
12 changes: 9 additions & 3 deletions ci/github/system-testing/e2e.bash
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,12 @@ install() {
echo "--------------- getting simcore docker images..."
make pull-version || ( (make pull-cache || true) && make build tag-version)
make info-images

# configure simcore for testing with a private registry
bash tests/e2e/setup_env_insecure_registry
# start simcore
make up-version
bash tests/e2e/scripts/setup_env_insecure_registry.bash

# start simcore and set log-level to debug
export LOG_LEVEL=INFO; make up-version

echo "-------------- installing test framework..."
# create a python venv and activate
Expand All @@ -34,6 +36,7 @@ install() {
echo "--------------- transfering the images to the local registry..."
make transfer-images-to-registry
echo "--------------- injecting templates in postgres db..."
make pg-db-tables
make inject-templates-in-db
popd
}
Expand All @@ -53,6 +56,9 @@ recover_artifacts() {
(docker service logs --timestamps simcore_storage > simcore_logs/storage.log) || true
(docker service logs --timestamps simcore_sidecar > simcore_logs/sidecar.log) || true
(docker service logs --timestamps simcore_catalog > simcore_logs/catalog.log) || true

# stack config
(cp .stack-simcore-version.yml simcore_logs/) || true
}

clean_up() {
Expand Down
9 changes: 6 additions & 3 deletions ci/travis/system-testing/e2e.bash
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,15 @@ before_script() {
make pull-version || ( (make pull-cache || true) && make build tag-version)
make info-images
# configure simcore for testing with a private registry
bash tests/e2e/setup_env_insecure_registry
# start simcore
make up-version
bash tests/e2e/scripts/setup_env_insecure_registry.bash

# start simcore and set log-level to debug
export LOG_LEVEL=INFO; make up-version

echo "-------------- installing test framework..."
# create a python venv and activate
make .venv
# shellcheck disable=SC1091
source .venv/bin/activate
bash ci/helpers/ensure_python_pip.bash
pushd tests/e2e;
Expand All @@ -42,6 +44,7 @@ before_script() {
echo "--------------- transfering the images to the local registry..."
make transfer-images-to-registry
echo "--------------- injecting templates in postgres db..."
make pg-db-tables
make inject-templates-in-db
popd
}
Expand Down
11 changes: 11 additions & 0 deletions packages/postgres-database/requirements/prod.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# Shortcut to install 'simcore-postgres-database'
#
# Usage:
# pip install -r requirements/prod.txt
#

# installs requirements first
-r _base.txt
-r _migration.txt

.[migration]
1 change: 1 addition & 0 deletions services/catalog/src/simcore_service_catalog/db.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ async def teardown_engine() -> None:


async def create_tables(conn: SAConnection):
# FIXME: this is dangerous since it enforces an empty table
await conn.execute(f"DROP TABLE IF EXISTS {DAG.__tablename__}")
await conn.execute(CreateTable(dags))

Expand Down
129 changes: 102 additions & 27 deletions services/director/tests/fixtures/fake_services.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,26 +13,58 @@

_logger = logging.getLogger(__name__)


@pytest.fixture(scope="function")
def push_services(loop, docker_registry, tmpdir):
registry_url = docker_registry
tmp_dir = Path(tmpdir)

list_of_pushed_images_tags = []
dependent_images = []
def build_push_images(number_of_computational_services, number_of_interactive_services, inter_dependent_services=False, bad_json_format=False, version="1.0."):

def build_push_images(
number_of_computational_services,
number_of_interactive_services,
inter_dependent_services=False,
bad_json_format=False,
version="1.0.",
):
try:
dependent_image = None
if inter_dependent_services:
dependent_image = _build_push_image(tmp_dir, registry_url, "computational", "dependency", "10.52.999999", None, bad_json_format=bad_json_format)
dependent_image = _build_push_image(
tmp_dir,
registry_url,
"computational",
"dependency",
"10.52.999999",
None,
bad_json_format=bad_json_format,
)
dependent_images.append(dependent_image)

for image_index in range(0, number_of_computational_services):
image = _build_push_image(tmp_dir, registry_url, "computational", "test", version + str(image_index), dependent_image, bad_json_format=bad_json_format)
image = _build_push_image(
tmp_dir,
registry_url,
"computational",
"test",
version + str(image_index),
dependent_image,
bad_json_format=bad_json_format,
)
list_of_pushed_images_tags.append(image)

for image_index in range(0, number_of_interactive_services):
image = _build_push_image(tmp_dir, registry_url, "dynamic", "test", version + str(image_index), dependent_image, bad_json_format=bad_json_format)
image = _build_push_image(
tmp_dir,
registry_url,
"dynamic",
"test",
version + str(image_index),
dependent_image,
bad_json_format=bad_json_format,
)
list_of_pushed_images_tags.append(image)
except docker.errors.APIError:
_logger.exception("Unexpected docker API error")
Expand All @@ -45,70 +77,110 @@ def build_push_images(number_of_computational_services, number_of_interactive_se
_clean_registry(registry_url, list_of_pushed_images_tags)
_clean_registry(registry_url, dependent_images)

def _build_push_image(docker_dir, registry_url, service_type, name, tag, dependent_image=None, *, bad_json_format=False): # pylint: disable=R0913

def _build_push_image(
docker_dir,
registry_url,
service_type,
name,
tag,
dependent_image=None,
*,
bad_json_format=False
): # pylint: disable=R0913
docker_client = docker.from_env()
# crate image
service_description = _create_service_description(service_type, name, tag)
docker_labels = _create_docker_labels(service_description, bad_json_format)
additional_docker_labels = [{"name": "constraints", "type": "string", "value": ["node.role==manager"]}]
additional_docker_labels = [
{"name": "constraints", "type": "string", "value": ["node.role==manager"]}
]
internal_port = None
entry_point = ''
entry_point = ""
if service_type == "dynamic":
internal_port = random.randint(1, 65535)
additional_docker_labels.append({"name": "ports", "type": "int", "value": internal_port})
additional_docker_labels.append(
{"name": "ports", "type": "int", "value": internal_port}
)
entry_point = "/test/entry_point"
docker_labels["simcore.service.bootsettings"] = json.dumps([{"name": "entry_point", "type": "string", "value": entry_point}])
docker_labels["simcore.service.bootsettings"] = json.dumps(
[{"name": "entry_point", "type": "string", "value": entry_point}]
)
docker_labels["simcore.service.settings"] = json.dumps(additional_docker_labels)
if bad_json_format:
docker_labels["simcore.service.settings"] = "'fjks" + docker_labels["simcore.service.settings"]
docker_labels["simcore.service.settings"] = (
"'fjks" + docker_labels["simcore.service.settings"]
)

if dependent_image is not None:
dependent_description = dependent_image["service_description"]
dependency_docker_labels = [{"key":dependent_description["key"], "tag":dependent_description["version"]}]
docker_labels["simcore.service.dependencies"] = json.dumps(dependency_docker_labels)
dependency_docker_labels = [
{
"key": dependent_description["key"],
"tag": dependent_description["version"],
}
]
docker_labels["simcore.service.dependencies"] = json.dumps(
dependency_docker_labels
)
if bad_json_format:
docker_labels["simcore.service.dependencies"] = "'fjks" + docker_labels["simcore.service.dependencies"]
docker_labels["simcore.service.dependencies"] = (
"'fjks" + docker_labels["simcore.service.dependencies"]
)

image = _create_base_image(docker_dir, docker_labels)
# tag image
image_tag = registry_url + "/{key}:{version}".format(key=service_description["key"], version=tag)
image_tag = registry_url + "/{key}:{version}".format(
key=service_description["key"], version=tag
)
assert image.tag(image_tag) is True
# push image to registry
docker_client.images.push(image_tag)
# remove image from host
docker_client.images.remove(image_tag)
return {
"service_description":service_description,
"docker_labels":docker_labels,
"image_path":image_tag,
"internal_port":internal_port,
"entry_point": entry_point
}
"service_description": service_description,
"docker_labels": docker_labels,
"image_path": image_tag,
"internal_port": internal_port,
"entry_point": entry_point,
}


def _clean_registry(registry_url, list_of_images):
request_headers = {'accept': "application/vnd.docker.distribution.manifest.v2+json"}
request_headers = {"accept": "application/vnd.docker.distribution.manifest.v2+json"}
for image in list_of_images:
service_description = image["service_description"]
# get the image digest
tag = service_description["version"]
url = "http://{host}/v2/{name}/manifests/{tag}".format(host=registry_url, name=service_description["key"], tag=tag)
url = "http://{host}/v2/{name}/manifests/{tag}".format(
host=registry_url, name=service_description["key"], tag=tag
)
response = requests.get(url, headers=request_headers)
docker_content_digest = response.headers["Docker-Content-Digest"]
# remove the image from the registry
url = "http://{host}/v2/{name}/manifests/{digest}".format(host=registry_url, name=service_description["key"], digest=docker_content_digest)
url = "http://{host}/v2/{name}/manifests/{digest}".format(
host=registry_url,
name=service_description["key"],
digest=docker_content_digest,
)
response = requests.delete(url, headers=request_headers)


def _create_base_image(base_dir, labels):
# create a basic dockerfile
docker_file = base_dir / "Dockerfile"
with docker_file.open("w") as file_pointer:
file_pointer.write('FROM alpine\nCMD while true; do sleep 10; done\n')
file_pointer.write("FROM alpine\nCMD while true; do sleep 10; done\n")
assert docker_file.exists() == True
# build docker base image
docker_client = docker.from_env()
base_docker_image = docker_client.images.build(path=str(base_dir), rm=True, labels=labels)
base_docker_image = docker_client.images.build(
path=str(base_dir), rm=True, labels=labels
)
return base_docker_image[0]


def _create_service_description(service_type, name, tag):
file_name = "dummy_service_description-v1.json"
dummy_description_path = Path(__file__).parent / file_name
Expand All @@ -125,10 +197,13 @@ def _create_service_description(service_type, name, tag):

return service_desc


def _create_docker_labels(service_description, bad_json_format):
docker_labels = {}
for key, value in service_description.items():
docker_labels[".".join(["io", "simcore", key])] = json.dumps({key:value})
docker_labels[".".join(["io", "simcore", key])] = json.dumps({key: value})
if bad_json_format:
docker_labels[".".join(["io", "simcore", key])] = "d32;'" + docker_labels[".".join(["io", "simcore", key])]
docker_labels[".".join(["io", "simcore", key])] = (
"d32;'" + docker_labels[".".join(["io", "simcore", key])]
)
return docker_labels
40 changes: 29 additions & 11 deletions services/director/tests/test_registry_cache_task.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,22 +4,28 @@

import pytest

from simcore_service_director import (config, main, registry_cache_task,
registry_proxy)
from simcore_service_director import config, main, registry_cache_task, registry_proxy


@pytest.fixture
def client(loop, aiohttp_client, aiohttp_unused_port, configure_schemas_location, configure_registry_access):
def client(
loop,
aiohttp_client,
aiohttp_unused_port,
configure_schemas_location,
configure_registry_access,
):
config.DIRECTOR_REGISTRY_CACHING = True
config.DIRECTOR_REGISTRY_CACHING_TTL = 5
# config.DIRECTOR_REGISTRY_CACHING_TTL = 5
app = main.setup_app()
server_kwargs={'port': aiohttp_unused_port(), 'host': 'localhost'}
server_kwargs = {"port": aiohttp_unused_port(), "host": "localhost"}

registry_cache_task.setup(app)

yield loop.run_until_complete(aiohttp_client(app, server_kwargs=server_kwargs))


async def test_registry_caching_task(loop, client, push_services):
app = client.app
assert app
Expand All @@ -30,17 +36,29 @@ async def test_registry_caching_task(loop, client, push_services):
assert registry_cache_task.APP_REGISTRY_CACHE_DATA_KEY in app

# check we do not get any repository
list_of_services = await registry_proxy.list_services(app, registry_proxy.ServiceType.ALL)
list_of_services = await registry_proxy.list_services(
app, registry_proxy.ServiceType.ALL
)
assert not list_of_services
assert app[registry_cache_task.APP_REGISTRY_CACHE_DATA_KEY] != {}
# create services in the registry
pushed_services = push_services(1,1)
pushed_services = push_services(
number_of_computational_services=1, number_of_interactive_services=1
)
# the services shall be updated
await sleep(config.DIRECTOR_REGISTRY_CACHING_TTL)
list_of_services = await registry_proxy.list_services(app, registry_proxy.ServiceType.ALL)
list_of_services = await registry_proxy.list_services(
app, registry_proxy.ServiceType.ALL
)
assert len(list_of_services) == 2
# add more
pushed_services = push_services(2,2, version="2.0.")
await sleep(config.DIRECTOR_REGISTRY_CACHING_TTL)
list_of_services = await registry_proxy.list_services(app, registry_proxy.ServiceType.ALL)
assert len(list_of_services) == len(pushed_services)
pushed_services = push_services(
number_of_computational_services=2,
number_of_interactive_services=2,
version="2.0.",
)
await sleep(config.DIRECTOR_REGISTRY_CACHING_TTL * 1.1) # NOTE: this sometimes takes a bit more. Sleep increased a 10%.
list_of_services = await registry_proxy.list_services(
app, registry_proxy.ServiceType.ALL
)
assert len(list_of_services) == len(pushed_services)
8 changes: 4 additions & 4 deletions services/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ services:
- POSTGRES_HOST=${POSTGRES_HOST}
- POSTGRES_PORT=${POSTGRES_PORT}
- TESTING=false
- LOGLEVEL=WARNING
- LOGLEVEL=${LOG_LEVEL:-WARNING}
depends_on:
- postgres
networks:
Expand Down Expand Up @@ -64,7 +64,7 @@ services:
- STORAGE_PORT=8080
- SWARM_STACK_NAME=${SWARM_STACK_NAME:-simcore}
- WEBSERVER_MONITORING_ENABLED=1
- WEBSERVER_LOGLEVEL=WARNING
- WEBSERVER_LOGLEVEL=${LOG_LEVEL:-WARNING}
env_file:
- ../.env
depends_on:
Expand Down Expand Up @@ -118,7 +118,7 @@ services:
- REGISTRY_USER=${REGISTRY_USER}
- REGISTRY_PW=${REGISTRY_PW}
- SWARM_STACK_NAME=${SWARM_STACK_NAME:-simcore}
- SIDECAR_LOGLEVEL=WARNING
- SIDECAR_LOGLEVEL=${LOG_LEVEL:-WARNING}
depends_on:
- rabbit
- postgres
Expand All @@ -135,7 +135,7 @@ services:
- POSTGRES_DB=${POSTGRES_DB}
- POSTGRES_HOST=${POSTGRES_HOST}
- POSTGRES_PORT=${POSTGRES_PORT}
- STORAGE_LOGLEVEL=WARNING
- STORAGE_LOGLEVEL=${LOG_LEVEL:-WARNING}
- STORAGE_MONITORING_ENABLED=1
- S3_ENDPOINT=${S3_ENDPOINT}
- S3_ACCESS_KEY=${S3_ACCESS_KEY}
Expand Down
Loading