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

✨ Maintenance/add consistency scripts #2531

Merged

Conversation

sanderegg
Copy link
Member

@sanderegg sanderegg commented Sep 7, 2021

What do these changes do?

  • adds a script for checking consistency between the file entries in the projects/file_meta_data tables in the database and what is available on S3

The scripts does the following:
pre-requisite:

  • local docker volume containing a database from a deployment (see make import-db-from-docker-volume in /packages/postgres-database)
  1. from the local DB parses the projects table for all the node UUIDs available used by some non-GUEST user
  2. from the local DB parses the file_meta_data table for all file entries corresponding to the node UUIDs from 1.
  3. from the corresponding S3 endpoint parses all the file corresponding to the node UUIDs from 1.
  4. Compare files parsed in DB to the ones in S3
  5. create a report as csv file containing

Related issue/s

How to test

Checklist

@sanderegg sanderegg self-assigned this Sep 7, 2021
@codecov
Copy link

codecov bot commented Sep 7, 2021

Codecov Report

Merging #2531 (5ab4637) into master (6aa8d03) will decrease coverage by 0.0%.
The diff coverage is n/a.

Impacted file tree graph

@@           Coverage Diff            @@
##           master   #2531     +/-   ##
========================================
- Coverage    76.5%   76.5%   -0.1%     
========================================
  Files         610     610             
  Lines       23397   23397             
  Branches     2294    2294             
========================================
- Hits        17917   17909      -8     
- Misses       4873    4880      +7     
- Partials      607     608      +1     
Flag Coverage Δ
integrationtests 66.4% <ø> (-0.1%) ⬇️
unittests 70.6% <ø> (-0.1%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
..._director_v2/modules/dynamic_sidecar/client_api.py 76.6% <0.0%> (-5.6%) ⬇️
...tor_v2/modules/dynamic_sidecar/scheduler/events.py 93.6% <0.0%> (-3.8%) ⬇️
..._director_v2/modules/dynamic_sidecar/docker_api.py 85.8% <0.0%> (-0.7%) ⬇️
.../director/src/simcore_service_director/producer.py 61.2% <0.0%> (-0.3%) ⬇️
...ce_webserver/resource_manager/garbage_collector.py 73.9% <0.0%> (+0.8%) ⬆️

@pcrespov
Copy link
Member

pcrespov commented Sep 8, 2021

Super nice and useful scripts!

A few suggestion:

  • dump data in csv files with headers (can be opened and explored in excel-like)
  • in s3_missing_files.csv add columns with file size and last modification date (see below). This helps to explore the consistency
  • add docker pull mino/cl before doing requests to s3. otherwise captured stdout is polluted with log message from pulling instead of the client responses
  • EXTRA: prompt passwords/secret instead of passing them as arguments. This way they do not remain in the history.
  • EXTRA: option to use dumped files as cache instead of re-running requests

image

@sanderegg sanderegg force-pushed the maintenance/add_consistency_scripts branch from b5c67e9 to 1bb8f3a Compare September 9, 2021 06:00
@sanderegg sanderegg force-pushed the maintenance/add_consistency_scripts branch from 1bb8f3a to 5ac74cf Compare September 9, 2021 06:01
@sanderegg sanderegg marked this pull request as ready for review September 9, 2021 06:01
@sanderegg sanderegg added the a:infra+ops maintenance of infrastructure or operations (discussed in retro) label Sep 9, 2021
@sanderegg sanderegg added this to the Chevrotain milestone Sep 9, 2021
@sanderegg sanderegg changed the title WIP: Maintenance/add consistency scripts Maintenance/add consistency scripts Sep 9, 2021
@sanderegg sanderegg changed the title Maintenance/add consistency scripts ✨ Maintenance/add consistency scripts Sep 9, 2021

def write_file(file_path: Path, data, fieldnames):
with file_path.open("w", newline="") as csvfile:
csv_writer = csv.writer(csvfile)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nce touch

Copy link
Member

@mguidon mguidon left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

real nice

@sanderegg sanderegg merged commit 2b49ad5 into ITISFoundation:master Sep 9, 2021
@sanderegg sanderegg deleted the maintenance/add_consistency_scripts branch September 10, 2021 11:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
a:infra+ops maintenance of infrastructure or operations (discussed in retro)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants