python3-cyberfusion-queue-support 2.3__tar.gz → 2.5__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.3 → python3_cyberfusion_queue_support-2.5}/PKG-INFO +1 -1
- {python3_cyberfusion_queue_support-2.3 → python3_cyberfusion_queue_support-2.5}/pyproject.toml +1 -1
- {python3_cyberfusion_queue_support-2.3 → python3_cyberfusion_queue_support-2.5}/src/cyberfusion/QueueSupport/__init__.py +17 -11
- {python3_cyberfusion_queue_support-2.3 → python3_cyberfusion_queue_support-2.5}/src/cyberfusion/QueueSupport/database.py +1 -0
- {python3_cyberfusion_queue_support-2.3 → python3_cyberfusion_queue_support-2.5}/src/cyberfusion/QueueSupport/exceptions/__init__.py +2 -8
- {python3_cyberfusion_queue_support-2.3 → python3_cyberfusion_queue_support-2.5}/src/cyberfusion/QueueSupport/items/command.py +4 -3
- python3_cyberfusion_queue_support-2.5/src/cyberfusion/QueueSupport/migrations/versions/8023b9eecdd1_add_traceback_to_queue_items.py +25 -0
- {python3_cyberfusion_queue_support-2.3 → python3_cyberfusion_queue_support-2.5}/src/cyberfusion/QueueSupport/outcomes.py +16 -2
- python3_cyberfusion_queue_support-2.5/src/cyberfusion/QueueSupport/sentinels.py +3 -0
- {python3_cyberfusion_queue_support-2.3 → python3_cyberfusion_queue_support-2.5}/src/python3_cyberfusion_queue_support.egg-info/PKG-INFO +1 -1
- {python3_cyberfusion_queue_support-2.3 → python3_cyberfusion_queue_support-2.5}/src/python3_cyberfusion_queue_support.egg-info/SOURCES.txt +2 -0
- {python3_cyberfusion_queue_support-2.3 → python3_cyberfusion_queue_support-2.5}/README.md +0 -0
- {python3_cyberfusion_queue_support-2.3 → python3_cyberfusion_queue_support-2.5}/setup.cfg +0 -0
- {python3_cyberfusion_queue_support-2.3 → python3_cyberfusion_queue_support-2.5}/src/cyberfusion/QueueSupport/encoders.py +0 -0
- {python3_cyberfusion_queue_support-2.3 → python3_cyberfusion_queue_support-2.5}/src/cyberfusion/QueueSupport/interfaces.py +0 -0
- {python3_cyberfusion_queue_support-2.3 → python3_cyberfusion_queue_support-2.5}/src/cyberfusion/QueueSupport/items/__init__.py +0 -0
- {python3_cyberfusion_queue_support-2.3 → python3_cyberfusion_queue_support-2.5}/src/cyberfusion/QueueSupport/items/chmod.py +0 -0
- {python3_cyberfusion_queue_support-2.3 → python3_cyberfusion_queue_support-2.5}/src/cyberfusion/QueueSupport/items/chown.py +0 -0
- {python3_cyberfusion_queue_support-2.3 → python3_cyberfusion_queue_support-2.5}/src/cyberfusion/QueueSupport/items/copy.py +0 -0
- {python3_cyberfusion_queue_support-2.3 → python3_cyberfusion_queue_support-2.5}/src/cyberfusion/QueueSupport/items/database_create.py +0 -0
- {python3_cyberfusion_queue_support-2.3 → python3_cyberfusion_queue_support-2.5}/src/cyberfusion/QueueSupport/items/database_drop.py +0 -0
- {python3_cyberfusion_queue_support-2.3 → python3_cyberfusion_queue_support-2.5}/src/cyberfusion/QueueSupport/items/database_user_drop.py +0 -0
- {python3_cyberfusion_queue_support-2.3 → python3_cyberfusion_queue_support-2.5}/src/cyberfusion/QueueSupport/items/database_user_ensure_state.py +0 -0
- {python3_cyberfusion_queue_support-2.3 → python3_cyberfusion_queue_support-2.5}/src/cyberfusion/QueueSupport/items/database_user_grant_grant.py +0 -0
- {python3_cyberfusion_queue_support-2.3 → python3_cyberfusion_queue_support-2.5}/src/cyberfusion/QueueSupport/items/database_user_grant_revoke.py +0 -0
- {python3_cyberfusion_queue_support-2.3 → python3_cyberfusion_queue_support-2.5}/src/cyberfusion/QueueSupport/items/mkdir.py +0 -0
- {python3_cyberfusion_queue_support-2.3 → python3_cyberfusion_queue_support-2.5}/src/cyberfusion/QueueSupport/items/move.py +0 -0
- {python3_cyberfusion_queue_support-2.3 → python3_cyberfusion_queue_support-2.5}/src/cyberfusion/QueueSupport/items/rmtree.py +0 -0
- {python3_cyberfusion_queue_support-2.3 → python3_cyberfusion_queue_support-2.5}/src/cyberfusion/QueueSupport/items/systemd_daemon_reload.py +0 -0
- {python3_cyberfusion_queue_support-2.3 → python3_cyberfusion_queue_support-2.5}/src/cyberfusion/QueueSupport/items/systemd_tmp_files_create.py +0 -0
- {python3_cyberfusion_queue_support-2.3 → python3_cyberfusion_queue_support-2.5}/src/cyberfusion/QueueSupport/items/systemd_unit_disable.py +0 -0
- {python3_cyberfusion_queue_support-2.3 → python3_cyberfusion_queue_support-2.5}/src/cyberfusion/QueueSupport/items/systemd_unit_enable.py +0 -0
- {python3_cyberfusion_queue_support-2.3 → python3_cyberfusion_queue_support-2.5}/src/cyberfusion/QueueSupport/items/systemd_unit_reload.py +0 -0
- {python3_cyberfusion_queue_support-2.3 → python3_cyberfusion_queue_support-2.5}/src/cyberfusion/QueueSupport/items/systemd_unit_restart.py +0 -0
- {python3_cyberfusion_queue_support-2.3 → python3_cyberfusion_queue_support-2.5}/src/cyberfusion/QueueSupport/items/systemd_unit_start.py +0 -0
- {python3_cyberfusion_queue_support-2.3 → python3_cyberfusion_queue_support-2.5}/src/cyberfusion/QueueSupport/items/systemd_unit_stop.py +0 -0
- {python3_cyberfusion_queue_support-2.3 → python3_cyberfusion_queue_support-2.5}/src/cyberfusion/QueueSupport/items/unlink.py +0 -0
- {python3_cyberfusion_queue_support-2.3 → python3_cyberfusion_queue_support-2.5}/src/cyberfusion/QueueSupport/migrations/__init__.py +0 -0
- {python3_cyberfusion_queue_support-2.3 → python3_cyberfusion_queue_support-2.5}/src/cyberfusion/QueueSupport/migrations/env.py +0 -0
- {python3_cyberfusion_queue_support-2.3 → python3_cyberfusion_queue_support-2.5}/src/cyberfusion/QueueSupport/migrations/versions/571e55ab5ed5_initial_migration.py +0 -0
- {python3_cyberfusion_queue_support-2.3 → python3_cyberfusion_queue_support-2.5}/src/cyberfusion/QueueSupport/migrations/versions/9ae29b5db790_add_string_to_queue_item_outcomes.py +0 -0
- {python3_cyberfusion_queue_support-2.3 → python3_cyberfusion_queue_support-2.5}/src/cyberfusion/QueueSupport/migrations/versions/__init__.py +0 -0
- {python3_cyberfusion_queue_support-2.3 → python3_cyberfusion_queue_support-2.5}/src/cyberfusion/QueueSupport/settings.py +0 -0
- {python3_cyberfusion_queue_support-2.3 → python3_cyberfusion_queue_support-2.5}/src/cyberfusion/QueueSupport/utilities.py +0 -0
- {python3_cyberfusion_queue_support-2.3 → python3_cyberfusion_queue_support-2.5}/src/python3_cyberfusion_queue_support.egg-info/dependency_links.txt +0 -0
- {python3_cyberfusion_queue_support-2.3 → python3_cyberfusion_queue_support-2.5}/src/python3_cyberfusion_queue_support.egg-info/entry_points.txt +0 -0
- {python3_cyberfusion_queue_support-2.3 → python3_cyberfusion_queue_support-2.5}/src/python3_cyberfusion_queue_support.egg-info/requires.txt +0 -0
- {python3_cyberfusion_queue_support-2.3 → python3_cyberfusion_queue_support-2.5}/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.
|
|
3
|
+
Version: 2.5
|
|
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
|
|
@@ -4,7 +4,7 @@ import logging
|
|
|
4
4
|
from copy import copy
|
|
5
5
|
from dataclasses import dataclass
|
|
6
6
|
from typing import List
|
|
7
|
-
|
|
7
|
+
import traceback
|
|
8
8
|
from cyberfusion.QueueSupport.database import (
|
|
9
9
|
Queue as QueueModel,
|
|
10
10
|
QueueItem,
|
|
@@ -12,7 +12,7 @@ from cyberfusion.QueueSupport.database import (
|
|
|
12
12
|
QueueItemOutcome,
|
|
13
13
|
QueueProcess,
|
|
14
14
|
)
|
|
15
|
-
|
|
15
|
+
|
|
16
16
|
from cyberfusion.QueueSupport.interfaces import OutcomeInterface
|
|
17
17
|
from cyberfusion.QueueSupport.items import _Item
|
|
18
18
|
|
|
@@ -78,6 +78,7 @@ class Queue:
|
|
|
78
78
|
hide_outcomes=item.hide_outcomes,
|
|
79
79
|
deduplicated=deduplicated,
|
|
80
80
|
attributes=item_dict,
|
|
81
|
+
traceback=None,
|
|
81
82
|
)
|
|
82
83
|
|
|
83
84
|
self._database_session.add(object_)
|
|
@@ -105,7 +106,7 @@ class Queue:
|
|
|
105
106
|
if not item_mapping.database_object.deduplicated
|
|
106
107
|
]:
|
|
107
108
|
logger.debug(
|
|
108
|
-
"Processing item with
|
|
109
|
+
"Processing item with ID '%s'", item_mapping.database_object.id
|
|
109
110
|
)
|
|
110
111
|
|
|
111
112
|
item_outcomes = []
|
|
@@ -116,7 +117,7 @@ class Queue:
|
|
|
116
117
|
else:
|
|
117
118
|
try:
|
|
118
119
|
logger.debug(
|
|
119
|
-
"Fulfilling item with
|
|
120
|
+
"Fulfilling item with ID '%s'", item_mapping.database_object.id
|
|
120
121
|
)
|
|
121
122
|
|
|
122
123
|
if item_mapping.item.hide_outcomes:
|
|
@@ -125,14 +126,19 @@ class Queue:
|
|
|
125
126
|
item_outcomes.extend(item_mapping.item.fulfill())
|
|
126
127
|
|
|
127
128
|
logger.debug(
|
|
128
|
-
"Fulfilled item with
|
|
129
|
+
"Fulfilled item with ID '%s'", item_mapping.database_object.id
|
|
129
130
|
)
|
|
130
|
-
except QueueFulfillFailed:
|
|
131
|
-
raise
|
|
132
131
|
except Exception as e:
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
132
|
+
logger.exception(e)
|
|
133
|
+
|
|
134
|
+
item_mapping.database_object.traceback = traceback.format_exc()
|
|
135
|
+
|
|
136
|
+
self._database_session.add(item_mapping.database_object)
|
|
137
|
+
self._database_session.commit()
|
|
138
|
+
|
|
139
|
+
# Don't fulfill other queue items
|
|
140
|
+
|
|
141
|
+
break
|
|
136
142
|
|
|
137
143
|
outcomes.extend(item_outcomes)
|
|
138
144
|
|
|
@@ -149,7 +155,7 @@ class Queue:
|
|
|
149
155
|
|
|
150
156
|
self._database_session.commit()
|
|
151
157
|
|
|
152
|
-
logger.debug("Processed item with
|
|
158
|
+
logger.debug("Processed item with ID '%s'", item_mapping.database_object.id)
|
|
153
159
|
|
|
154
160
|
logger.debug("Processed items")
|
|
155
161
|
|
|
@@ -106,6 +106,7 @@ class QueueItem(BaseModel):
|
|
|
106
106
|
hide_outcomes = Column(Boolean, nullable=False)
|
|
107
107
|
deduplicated = Column(Boolean, nullable=False)
|
|
108
108
|
attributes = Column(JSON, nullable=False)
|
|
109
|
+
traceback = Column(String(), nullable=True)
|
|
109
110
|
|
|
110
111
|
|
|
111
112
|
class QueueItemOutcome(BaseModel):
|
|
@@ -20,16 +20,10 @@ class PathIsSymlinkError(ItemError):
|
|
|
20
20
|
|
|
21
21
|
|
|
22
22
|
@dataclass
|
|
23
|
-
class
|
|
24
|
-
"""Error occurred while fulfilling queue."""
|
|
25
|
-
|
|
26
|
-
item: _Item
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
@dataclass
|
|
30
|
-
class CommandQueueFulfillFailed(QueueFulfillFailed):
|
|
23
|
+
class CommandQueueFulfillFailed(Exception):
|
|
31
24
|
"""Error occurred while fulfilling queue, with command item."""
|
|
32
25
|
|
|
26
|
+
item: _Item
|
|
33
27
|
command: List[str]
|
|
34
28
|
stdout: str
|
|
35
29
|
stderr: str
|
|
@@ -45,11 +45,12 @@ class CommandItem(_Item):
|
|
|
45
45
|
outcome.command,
|
|
46
46
|
check=True,
|
|
47
47
|
text=True,
|
|
48
|
-
|
|
48
|
+
stdout=subprocess.PIPE,
|
|
49
|
+
stderr=subprocess.PIPE,
|
|
49
50
|
)
|
|
50
51
|
|
|
51
|
-
|
|
52
|
-
|
|
52
|
+
outcome.stdout = output.stdout
|
|
53
|
+
outcome.stderr = output.stderr
|
|
53
54
|
except subprocess.CalledProcessError as e:
|
|
54
55
|
raise CommandQueueFulfillFailed(
|
|
55
56
|
self, command=outcome.command, stdout=e.stdout, stderr=e.stderr
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
"""Add traceback to queue_items
|
|
2
|
+
|
|
3
|
+
Revision ID: 8023b9eecdd1
|
|
4
|
+
Revises: 9ae29b5db790
|
|
5
|
+
Create Date: 2025-06-07 12:32:49.485214
|
|
6
|
+
|
|
7
|
+
"""
|
|
8
|
+
|
|
9
|
+
from alembic import op
|
|
10
|
+
import sqlalchemy as sa
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
# revision identifiers, used by Alembic.
|
|
14
|
+
revision = "8023b9eecdd1"
|
|
15
|
+
down_revision = "9ae29b5db790"
|
|
16
|
+
branch_labels = None
|
|
17
|
+
depends_on = None
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
def upgrade() -> None:
|
|
21
|
+
op.add_column("queue_items", sa.Column("traceback", sa.String(), nullable=True))
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
def downgrade() -> None:
|
|
25
|
+
op.drop_column("queue_items", "traceback")
|
|
@@ -9,6 +9,8 @@ from cyberfusion.DatabaseSupport.databases import Database
|
|
|
9
9
|
from cyberfusion.QueueSupport.interfaces import OutcomeInterface
|
|
10
10
|
from cyberfusion.SystemdSupport.units import Unit
|
|
11
11
|
|
|
12
|
+
from cyberfusion.QueueSupport.sentinels import UNKNOWN
|
|
13
|
+
|
|
12
14
|
|
|
13
15
|
class CopyItemCopyOutcome(OutcomeInterface):
|
|
14
16
|
"""Represents outcome."""
|
|
@@ -147,9 +149,17 @@ class RmTreeItemRemoveOutcome(OutcomeInterface):
|
|
|
147
149
|
class CommandItemRunOutcome(OutcomeInterface):
|
|
148
150
|
"""Represents outcome."""
|
|
149
151
|
|
|
150
|
-
def __init__(
|
|
152
|
+
def __init__(
|
|
153
|
+
self,
|
|
154
|
+
*,
|
|
155
|
+
command: List[str],
|
|
156
|
+
stdout: str | UNKNOWN = UNKNOWN,
|
|
157
|
+
stderr: str | UNKNOWN = UNKNOWN,
|
|
158
|
+
) -> None:
|
|
151
159
|
"""Set attributes."""
|
|
152
160
|
self.command = command
|
|
161
|
+
self.stdout = stdout
|
|
162
|
+
self.stderr = stderr
|
|
153
163
|
|
|
154
164
|
def __str__(self) -> str:
|
|
155
165
|
"""Get human-readable string."""
|
|
@@ -160,7 +170,11 @@ class CommandItemRunOutcome(OutcomeInterface):
|
|
|
160
170
|
if not isinstance(other, CommandItemRunOutcome):
|
|
161
171
|
return False
|
|
162
172
|
|
|
163
|
-
return
|
|
173
|
+
return (
|
|
174
|
+
other.command == self.command
|
|
175
|
+
and other.stdout == self.stdout
|
|
176
|
+
and other.stderr == self.stderr
|
|
177
|
+
)
|
|
164
178
|
|
|
165
179
|
|
|
166
180
|
class ChmodItemModeChangeOutcome(OutcomeInterface):
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: python3-cyberfusion-queue-support
|
|
3
|
-
Version: 2.
|
|
3
|
+
Version: 2.5
|
|
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
|
|
@@ -6,6 +6,7 @@ src/cyberfusion/QueueSupport/database.py
|
|
|
6
6
|
src/cyberfusion/QueueSupport/encoders.py
|
|
7
7
|
src/cyberfusion/QueueSupport/interfaces.py
|
|
8
8
|
src/cyberfusion/QueueSupport/outcomes.py
|
|
9
|
+
src/cyberfusion/QueueSupport/sentinels.py
|
|
9
10
|
src/cyberfusion/QueueSupport/settings.py
|
|
10
11
|
src/cyberfusion/QueueSupport/utilities.py
|
|
11
12
|
src/cyberfusion/QueueSupport/exceptions/__init__.py
|
|
@@ -35,6 +36,7 @@ src/cyberfusion/QueueSupport/items/unlink.py
|
|
|
35
36
|
src/cyberfusion/QueueSupport/migrations/__init__.py
|
|
36
37
|
src/cyberfusion/QueueSupport/migrations/env.py
|
|
37
38
|
src/cyberfusion/QueueSupport/migrations/versions/571e55ab5ed5_initial_migration.py
|
|
39
|
+
src/cyberfusion/QueueSupport/migrations/versions/8023b9eecdd1_add_traceback_to_queue_items.py
|
|
38
40
|
src/cyberfusion/QueueSupport/migrations/versions/9ae29b5db790_add_string_to_queue_item_outcomes.py
|
|
39
41
|
src/cyberfusion/QueueSupport/migrations/versions/__init__.py
|
|
40
42
|
src/python3_cyberfusion_queue_support.egg-info/PKG-INFO
|
|
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
|
|
File without changes
|
|
File without changes
|
|
File without changes
|