python3-cyberfusion-queue-support 2.2__tar.gz → 2.2.2__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {python3_cyberfusion_queue_support-2.2 → python3_cyberfusion_queue_support-2.2.2}/PKG-INFO +1 -1
- {python3_cyberfusion_queue_support-2.2 → python3_cyberfusion_queue_support-2.2.2}/pyproject.toml +6 -1
- {python3_cyberfusion_queue_support-2.2 → python3_cyberfusion_queue_support-2.2.2}/src/cyberfusion/QueueSupport/database.py +12 -2
- python3_cyberfusion_queue_support-2.2.2/src/cyberfusion/QueueSupport/encoders.py +17 -0
- python3_cyberfusion_queue_support-2.2.2/src/cyberfusion/QueueSupport/migrations/__init__.py +0 -0
- python3_cyberfusion_queue_support-2.2.2/src/cyberfusion/QueueSupport/migrations/env.py +49 -0
- python3_cyberfusion_queue_support-2.2.2/src/cyberfusion/QueueSupport/migrations/versions/571e55ab5ed5_initial_migration.py +82 -0
- python3_cyberfusion_queue_support-2.2.2/src/cyberfusion/QueueSupport/migrations/versions/__init__.py +0 -0
- {python3_cyberfusion_queue_support-2.2 → python3_cyberfusion_queue_support-2.2.2}/src/cyberfusion/QueueSupport/settings.py +0 -1
- {python3_cyberfusion_queue_support-2.2 → python3_cyberfusion_queue_support-2.2.2}/src/python3_cyberfusion_queue_support.egg-info/PKG-INFO +1 -1
- {python3_cyberfusion_queue_support-2.2 → python3_cyberfusion_queue_support-2.2.2}/src/python3_cyberfusion_queue_support.egg-info/SOURCES.txt +5 -0
- {python3_cyberfusion_queue_support-2.2 → python3_cyberfusion_queue_support-2.2.2}/README.md +0 -0
- {python3_cyberfusion_queue_support-2.2 → python3_cyberfusion_queue_support-2.2.2}/setup.cfg +0 -0
- {python3_cyberfusion_queue_support-2.2 → python3_cyberfusion_queue_support-2.2.2}/src/cyberfusion/QueueSupport/__init__.py +0 -0
- {python3_cyberfusion_queue_support-2.2 → python3_cyberfusion_queue_support-2.2.2}/src/cyberfusion/QueueSupport/exceptions/__init__.py +0 -0
- {python3_cyberfusion_queue_support-2.2 → python3_cyberfusion_queue_support-2.2.2}/src/cyberfusion/QueueSupport/interfaces.py +0 -0
- {python3_cyberfusion_queue_support-2.2 → python3_cyberfusion_queue_support-2.2.2}/src/cyberfusion/QueueSupport/items/__init__.py +0 -0
- {python3_cyberfusion_queue_support-2.2 → python3_cyberfusion_queue_support-2.2.2}/src/cyberfusion/QueueSupport/items/chmod.py +0 -0
- {python3_cyberfusion_queue_support-2.2 → python3_cyberfusion_queue_support-2.2.2}/src/cyberfusion/QueueSupport/items/chown.py +0 -0
- {python3_cyberfusion_queue_support-2.2 → python3_cyberfusion_queue_support-2.2.2}/src/cyberfusion/QueueSupport/items/command.py +0 -0
- {python3_cyberfusion_queue_support-2.2 → python3_cyberfusion_queue_support-2.2.2}/src/cyberfusion/QueueSupport/items/copy.py +0 -0
- {python3_cyberfusion_queue_support-2.2 → python3_cyberfusion_queue_support-2.2.2}/src/cyberfusion/QueueSupport/items/database_create.py +0 -0
- {python3_cyberfusion_queue_support-2.2 → python3_cyberfusion_queue_support-2.2.2}/src/cyberfusion/QueueSupport/items/database_drop.py +0 -0
- {python3_cyberfusion_queue_support-2.2 → python3_cyberfusion_queue_support-2.2.2}/src/cyberfusion/QueueSupport/items/database_user_drop.py +0 -0
- {python3_cyberfusion_queue_support-2.2 → python3_cyberfusion_queue_support-2.2.2}/src/cyberfusion/QueueSupport/items/database_user_ensure_state.py +0 -0
- {python3_cyberfusion_queue_support-2.2 → python3_cyberfusion_queue_support-2.2.2}/src/cyberfusion/QueueSupport/items/database_user_grant_grant.py +0 -0
- {python3_cyberfusion_queue_support-2.2 → python3_cyberfusion_queue_support-2.2.2}/src/cyberfusion/QueueSupport/items/database_user_grant_revoke.py +0 -0
- {python3_cyberfusion_queue_support-2.2 → python3_cyberfusion_queue_support-2.2.2}/src/cyberfusion/QueueSupport/items/mkdir.py +0 -0
- {python3_cyberfusion_queue_support-2.2 → python3_cyberfusion_queue_support-2.2.2}/src/cyberfusion/QueueSupport/items/move.py +0 -0
- {python3_cyberfusion_queue_support-2.2 → python3_cyberfusion_queue_support-2.2.2}/src/cyberfusion/QueueSupport/items/rmtree.py +0 -0
- {python3_cyberfusion_queue_support-2.2 → python3_cyberfusion_queue_support-2.2.2}/src/cyberfusion/QueueSupport/items/systemd_daemon_reload.py +0 -0
- {python3_cyberfusion_queue_support-2.2 → python3_cyberfusion_queue_support-2.2.2}/src/cyberfusion/QueueSupport/items/systemd_tmp_files_create.py +0 -0
- {python3_cyberfusion_queue_support-2.2 → python3_cyberfusion_queue_support-2.2.2}/src/cyberfusion/QueueSupport/items/systemd_unit_disable.py +0 -0
- {python3_cyberfusion_queue_support-2.2 → python3_cyberfusion_queue_support-2.2.2}/src/cyberfusion/QueueSupport/items/systemd_unit_enable.py +0 -0
- {python3_cyberfusion_queue_support-2.2 → python3_cyberfusion_queue_support-2.2.2}/src/cyberfusion/QueueSupport/items/systemd_unit_reload.py +0 -0
- {python3_cyberfusion_queue_support-2.2 → python3_cyberfusion_queue_support-2.2.2}/src/cyberfusion/QueueSupport/items/systemd_unit_restart.py +0 -0
- {python3_cyberfusion_queue_support-2.2 → python3_cyberfusion_queue_support-2.2.2}/src/cyberfusion/QueueSupport/items/systemd_unit_start.py +0 -0
- {python3_cyberfusion_queue_support-2.2 → python3_cyberfusion_queue_support-2.2.2}/src/cyberfusion/QueueSupport/items/systemd_unit_stop.py +0 -0
- {python3_cyberfusion_queue_support-2.2 → python3_cyberfusion_queue_support-2.2.2}/src/cyberfusion/QueueSupport/items/unlink.py +0 -0
- {python3_cyberfusion_queue_support-2.2 → python3_cyberfusion_queue_support-2.2.2}/src/cyberfusion/QueueSupport/outcomes.py +0 -0
- {python3_cyberfusion_queue_support-2.2 → python3_cyberfusion_queue_support-2.2.2}/src/cyberfusion/QueueSupport/utilities.py +0 -0
- {python3_cyberfusion_queue_support-2.2 → python3_cyberfusion_queue_support-2.2.2}/src/python3_cyberfusion_queue_support.egg-info/dependency_links.txt +0 -0
- {python3_cyberfusion_queue_support-2.2 → python3_cyberfusion_queue_support-2.2.2}/src/python3_cyberfusion_queue_support.egg-info/entry_points.txt +0 -0
- {python3_cyberfusion_queue_support-2.2 → python3_cyberfusion_queue_support-2.2.2}/src/python3_cyberfusion_queue_support.egg-info/requires.txt +0 -0
- {python3_cyberfusion_queue_support-2.2 → python3_cyberfusion_queue_support-2.2.2}/src/python3_cyberfusion_queue_support.egg-info/top_level.txt +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: python3-cyberfusion-queue-support
|
|
3
|
-
Version: 2.2
|
|
3
|
+
Version: 2.2.2
|
|
4
4
|
Summary: Library to queue actions.
|
|
5
5
|
Author-email: Cyberfusion <support@cyberfusion.io>
|
|
6
6
|
Project-URL: Source, https://github.com/CyberfusionIO/python3-cyberfusion-queue-support
|
{python3_cyberfusion_queue_support-2.2 → python3_cyberfusion_queue_support-2.2.2}/pyproject.toml
RENAMED
|
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
|
|
|
4
4
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "python3-cyberfusion-queue-support"
|
|
7
|
-
version = "2.2"
|
|
7
|
+
version = "2.2.2"
|
|
8
8
|
description = "Library to queue actions."
|
|
9
9
|
readme = "README.md"
|
|
10
10
|
authors = [
|
|
@@ -23,3 +23,8 @@ dependencies = [
|
|
|
23
23
|
|
|
24
24
|
[project.scripts]
|
|
25
25
|
queue-support-migrate = "cyberfusion.QueueSupport.database:run_migrations"
|
|
26
|
+
|
|
27
|
+
[tool.coverage.run]
|
|
28
|
+
omit = [
|
|
29
|
+
"*/migrations/*"
|
|
30
|
+
]
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
from alembic.config import Config
|
|
2
|
+
import os
|
|
2
3
|
from alembic import command
|
|
3
4
|
import sqlite3
|
|
4
5
|
from datetime import datetime, timezone
|
|
6
|
+
|
|
5
7
|
from sqlalchemy.pool.base import _ConnectionRecord
|
|
6
8
|
from sqlalchemy import ForeignKey, MetaData, Boolean
|
|
7
9
|
from sqlalchemy import create_engine, Column, DateTime, Integer, String
|
|
@@ -11,6 +13,7 @@ from sqlalchemy.engine import Engine
|
|
|
11
13
|
from sqlalchemy import event
|
|
12
14
|
from sqlalchemy.types import JSON
|
|
13
15
|
|
|
16
|
+
from cyberfusion.QueueSupport.encoders import json_serialize
|
|
14
17
|
from cyberfusion.QueueSupport.settings import settings
|
|
15
18
|
|
|
16
19
|
|
|
@@ -33,15 +36,22 @@ def set_sqlite_pragma(
|
|
|
33
36
|
|
|
34
37
|
def run_migrations() -> None:
|
|
35
38
|
"""Upgrade database schema to latest version."""
|
|
36
|
-
alembic_config = Config(
|
|
39
|
+
alembic_config = Config()
|
|
40
|
+
|
|
37
41
|
alembic_config.set_main_option("sqlalchemy.url", settings.database_path)
|
|
42
|
+
alembic_config.set_main_option(
|
|
43
|
+
"script_location",
|
|
44
|
+
os.path.join(os.path.dirname(os.path.realpath(__file__)), "migrations"),
|
|
45
|
+
)
|
|
38
46
|
|
|
39
47
|
command.upgrade(alembic_config, "head")
|
|
40
48
|
|
|
41
49
|
|
|
42
50
|
def make_database_session() -> Session:
|
|
43
51
|
engine = create_engine(
|
|
44
|
-
settings.database_path,
|
|
52
|
+
settings.database_path,
|
|
53
|
+
connect_args={"check_same_thread": False},
|
|
54
|
+
json_serializer=json_serialize,
|
|
45
55
|
)
|
|
46
56
|
|
|
47
57
|
return sessionmaker(bind=engine)()
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import json
|
|
2
|
+
from json import JSONEncoder
|
|
3
|
+
from typing import Any
|
|
4
|
+
|
|
5
|
+
from cyberfusion.SystemdSupport import Unit
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
class CustomEncoder(JSONEncoder):
|
|
9
|
+
def default(self, o: Any) -> Any:
|
|
10
|
+
if isinstance(o, Unit):
|
|
11
|
+
return {"name": o.name}
|
|
12
|
+
|
|
13
|
+
return super().default(o)
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
def json_serialize(obj: Any) -> str:
|
|
17
|
+
return json.dumps(obj, cls=CustomEncoder)
|
|
File without changes
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
from logging.config import fileConfig
|
|
2
|
+
|
|
3
|
+
from sqlalchemy import engine_from_config
|
|
4
|
+
from sqlalchemy import pool
|
|
5
|
+
|
|
6
|
+
from alembic import context
|
|
7
|
+
|
|
8
|
+
from cyberfusion.QueueSupport import database
|
|
9
|
+
|
|
10
|
+
config = context.config
|
|
11
|
+
|
|
12
|
+
if config.config_file_name is not None:
|
|
13
|
+
fileConfig(config.config_file_name)
|
|
14
|
+
|
|
15
|
+
target_metadata = database.metadata
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
def run_migrations_offline() -> None:
|
|
19
|
+
url = config.get_main_option("sqlalchemy.url")
|
|
20
|
+
|
|
21
|
+
context.configure(
|
|
22
|
+
url=url,
|
|
23
|
+
target_metadata=target_metadata,
|
|
24
|
+
literal_binds=True,
|
|
25
|
+
dialect_opts={"paramstyle": "named"},
|
|
26
|
+
)
|
|
27
|
+
|
|
28
|
+
with context.begin_transaction():
|
|
29
|
+
context.run_migrations()
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
def run_migrations_online() -> None:
|
|
33
|
+
connectable = engine_from_config(
|
|
34
|
+
config.get_section(config.config_ini_section),
|
|
35
|
+
prefix="sqlalchemy.",
|
|
36
|
+
poolclass=pool.NullPool,
|
|
37
|
+
)
|
|
38
|
+
|
|
39
|
+
with connectable.connect() as connection:
|
|
40
|
+
context.configure(connection=connection, target_metadata=target_metadata)
|
|
41
|
+
|
|
42
|
+
with context.begin_transaction():
|
|
43
|
+
context.run_migrations()
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
if context.is_offline_mode():
|
|
47
|
+
run_migrations_offline()
|
|
48
|
+
else:
|
|
49
|
+
run_migrations_online()
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
"""Initial migration
|
|
2
|
+
|
|
3
|
+
Revision ID: 571e55ab5ed5
|
|
4
|
+
Revises:
|
|
5
|
+
Create Date: 2025-04-09 18:46:38.122919
|
|
6
|
+
|
|
7
|
+
"""
|
|
8
|
+
|
|
9
|
+
from alembic import op
|
|
10
|
+
import sqlalchemy as sa
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
# revision identifiers, used by Alembic.
|
|
14
|
+
revision = "571e55ab5ed5"
|
|
15
|
+
down_revision = None
|
|
16
|
+
branch_labels = None
|
|
17
|
+
depends_on = None
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
def upgrade() -> None:
|
|
21
|
+
op.create_table(
|
|
22
|
+
"queues",
|
|
23
|
+
sa.Column("id", sa.Integer(), nullable=False),
|
|
24
|
+
sa.Column("created_at", sa.DateTime(), nullable=False),
|
|
25
|
+
sa.PrimaryKeyConstraint("id", name=op.f("pk_queues")),
|
|
26
|
+
)
|
|
27
|
+
|
|
28
|
+
op.create_table(
|
|
29
|
+
"queue_items",
|
|
30
|
+
sa.Column("id", sa.Integer(), nullable=False),
|
|
31
|
+
sa.Column("created_at", sa.DateTime(), nullable=False),
|
|
32
|
+
sa.Column("queue_id", sa.Integer(), nullable=False),
|
|
33
|
+
sa.Column("type", sa.String(length=255), nullable=False),
|
|
34
|
+
sa.Column("reference", sa.String(length=255), nullable=True),
|
|
35
|
+
sa.Column("hide_outcomes", sa.Boolean(), nullable=False),
|
|
36
|
+
sa.Column("deduplicated", sa.Boolean(), nullable=False),
|
|
37
|
+
sa.Column("attributes", sa.JSON(), nullable=False),
|
|
38
|
+
sa.ForeignKeyConstraint(
|
|
39
|
+
["queue_id"], ["queues.id"], name=op.f("fk_queue_items_queue_id_queues")
|
|
40
|
+
),
|
|
41
|
+
sa.PrimaryKeyConstraint("id", name=op.f("pk_queue_items")),
|
|
42
|
+
)
|
|
43
|
+
|
|
44
|
+
op.create_table(
|
|
45
|
+
"queue_processes",
|
|
46
|
+
sa.Column("id", sa.Integer(), nullable=False),
|
|
47
|
+
sa.Column("created_at", sa.DateTime(), nullable=False),
|
|
48
|
+
sa.Column("queue_id", sa.Integer(), nullable=False),
|
|
49
|
+
sa.Column("preview", sa.Boolean(), nullable=False),
|
|
50
|
+
sa.ForeignKeyConstraint(
|
|
51
|
+
["queue_id"], ["queues.id"], name=op.f("fk_queue_processes_queue_id_queues")
|
|
52
|
+
),
|
|
53
|
+
sa.PrimaryKeyConstraint("id", name=op.f("pk_queue_processes")),
|
|
54
|
+
)
|
|
55
|
+
|
|
56
|
+
op.create_table(
|
|
57
|
+
"queue_item_outcomes",
|
|
58
|
+
sa.Column("id", sa.Integer(), nullable=False),
|
|
59
|
+
sa.Column("created_at", sa.DateTime(), nullable=False),
|
|
60
|
+
sa.Column("queue_item_id", sa.Integer(), nullable=False),
|
|
61
|
+
sa.Column("queue_process_id", sa.Integer(), nullable=False),
|
|
62
|
+
sa.Column("type", sa.String(length=255), nullable=False),
|
|
63
|
+
sa.Column("attributes", sa.JSON(), nullable=False),
|
|
64
|
+
sa.ForeignKeyConstraint(
|
|
65
|
+
["queue_item_id"],
|
|
66
|
+
["queue_items.id"],
|
|
67
|
+
name=op.f("fk_queue_item_outcomes_queue_item_id_queue_items"),
|
|
68
|
+
),
|
|
69
|
+
sa.ForeignKeyConstraint(
|
|
70
|
+
["queue_process_id"],
|
|
71
|
+
["queue_processes.id"],
|
|
72
|
+
name=op.f("fk_queue_item_outcomes_queue_process_id_queue_processes"),
|
|
73
|
+
),
|
|
74
|
+
sa.PrimaryKeyConstraint("id", name=op.f("pk_queue_item_outcomes")),
|
|
75
|
+
)
|
|
76
|
+
|
|
77
|
+
|
|
78
|
+
def downgrade() -> None:
|
|
79
|
+
op.drop_table("queue_item_outcomes")
|
|
80
|
+
op.drop_table("queue_processes")
|
|
81
|
+
op.drop_table("queue_items")
|
|
82
|
+
op.drop_table("queues")
|
python3_cyberfusion_queue_support-2.2.2/src/cyberfusion/QueueSupport/migrations/versions/__init__.py
ADDED
|
File without changes
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: python3-cyberfusion-queue-support
|
|
3
|
-
Version: 2.2
|
|
3
|
+
Version: 2.2.2
|
|
4
4
|
Summary: Library to queue actions.
|
|
5
5
|
Author-email: Cyberfusion <support@cyberfusion.io>
|
|
6
6
|
Project-URL: Source, https://github.com/CyberfusionIO/python3-cyberfusion-queue-support
|
|
@@ -3,6 +3,7 @@ pyproject.toml
|
|
|
3
3
|
setup.cfg
|
|
4
4
|
src/cyberfusion/QueueSupport/__init__.py
|
|
5
5
|
src/cyberfusion/QueueSupport/database.py
|
|
6
|
+
src/cyberfusion/QueueSupport/encoders.py
|
|
6
7
|
src/cyberfusion/QueueSupport/interfaces.py
|
|
7
8
|
src/cyberfusion/QueueSupport/outcomes.py
|
|
8
9
|
src/cyberfusion/QueueSupport/settings.py
|
|
@@ -31,6 +32,10 @@ src/cyberfusion/QueueSupport/items/systemd_unit_restart.py
|
|
|
31
32
|
src/cyberfusion/QueueSupport/items/systemd_unit_start.py
|
|
32
33
|
src/cyberfusion/QueueSupport/items/systemd_unit_stop.py
|
|
33
34
|
src/cyberfusion/QueueSupport/items/unlink.py
|
|
35
|
+
src/cyberfusion/QueueSupport/migrations/__init__.py
|
|
36
|
+
src/cyberfusion/QueueSupport/migrations/env.py
|
|
37
|
+
src/cyberfusion/QueueSupport/migrations/versions/571e55ab5ed5_initial_migration.py
|
|
38
|
+
src/cyberfusion/QueueSupport/migrations/versions/__init__.py
|
|
34
39
|
src/python3_cyberfusion_queue_support.egg-info/PKG-INFO
|
|
35
40
|
src/python3_cyberfusion_queue_support.egg-info/SOURCES.txt
|
|
36
41
|
src/python3_cyberfusion_queue_support.egg-info/dependency_links.txt
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|