- License Usage Calculation realised

- View License Usages
- Celery Beat container added
- First schedule in Celery Beat for calculating usage (hourly)
- repopack can now split for different components
- Various fixes as consequece of changing file_location / file_name ==> bucket_name / object_name
- Celery Routing / Queuing updated
This commit is contained in:
Josako
2024-10-11 16:33:36 +02:00
parent 5ffad160b1
commit 9f5f090f0c
57 changed files with 935 additions and 174 deletions

View File

@@ -124,31 +124,34 @@ def run_migrations_online():
with connectable.connect() as connection:
tenants = get_tenant_ids()
for tenant in tenants:
logger.info(f"Migrating tenant: {tenant}")
# set search path on the connection, which ensures that
# PostgreSQL will emit all CREATE / ALTER / DROP statements
# in terms of this schema by default
connection.execute(text(f'SET search_path TO "{tenant}", public'))
# in SQLAlchemy v2+ the search path change needs to be committed
connection.commit()
try:
logger.info(f"Migrating tenant: {tenant}")
# set search path on the connection, which ensures that
# PostgreSQL will emit all CREATE / ALTER / DROP statements
# in terms of this schema by default
connection.execute(text(f'SET search_path TO "{tenant}", public'))
# in SQLAlchemy v2+ the search path change needs to be committed
connection.commit()
# make use of non-supported SQLAlchemy attribute to ensure
# the dialect reflects tables in terms of the current tenant name
connection.dialect.default_schema_name = str(tenant)
# make use of non-supported SQLAlchemy attribute to ensure
# the dialect reflects tables in terms of the current tenant name
connection.dialect.default_schema_name = str(tenant)
context.configure(
connection=connection,
target_metadata=get_metadata(),
# literal_binds=True,
include_object=include_object,
)
context.configure(
connection=connection,
target_metadata=get_metadata(),
# literal_binds=True,
include_object=include_object,
)
with context.begin_transaction():
context.run_migrations()
with context.begin_transaction():
context.run_migrations()
# for checking migrate or upgrade is running
if getattr(config.cmd_opts, "autogenerate", False):
break
# for checking migrate or upgrade is running
if getattr(config.cmd_opts, "autogenerate", False):
break
except Exception as e:
continue
if context.is_offline_mode():

View File

@@ -60,7 +60,7 @@ def upgrade():
except S3Error as e:
if e.code == "NoSuchKey":
current_app.logger.warning(
f"Object {doc_version.file_location} not found in bucket {doc_version.bucket_name}. Skipping.")
f"Object {doc_version.object_name} not found in bucket {doc_version.bucket_name}. Skipping.")
continue # Move to the next item
else:
raise e # Handle other types of S3 errors