morp 5.2.0__tar.gz → 5.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.
- {morp-5.2.0 → morp-5.2.2}/PKG-INFO +1 -1
- {morp-5.2.0 → morp-5.2.2}/morp/__init__.py +1 -1
- {morp-5.2.0 → morp-5.2.2}/morp/interface/base.py +0 -1
- {morp-5.2.0 → morp-5.2.2}/morp/interface/dropfile.py +10 -4
- {morp-5.2.0 → morp-5.2.2}/morp/interface/sqs.py +5 -5
- {morp-5.2.0 → morp-5.2.2}/morp/message.py +2 -2
- {morp-5.2.0 → morp-5.2.2}/morp.egg-info/PKG-INFO +1 -1
- {morp-5.2.0 → morp-5.2.2}/LICENSE.txt +0 -0
- {morp-5.2.0 → morp-5.2.2}/README.md +0 -0
- {morp-5.2.0 → morp-5.2.2}/morp/__main__.py +0 -0
- {morp-5.2.0 → morp-5.2.2}/morp/compat.py +0 -0
- {morp-5.2.0 → morp-5.2.2}/morp/config.py +0 -0
- {morp-5.2.0 → morp-5.2.2}/morp/exception.py +0 -0
- {morp-5.2.0 → morp-5.2.2}/morp/interface/__init__.py +0 -0
- {morp-5.2.0 → morp-5.2.2}/morp.egg-info/SOURCES.txt +0 -0
- {morp-5.2.0 → morp-5.2.2}/morp.egg-info/dependency_links.txt +0 -0
- {morp-5.2.0 → morp-5.2.2}/morp.egg-info/entry_points.txt +0 -0
- {morp-5.2.0 → morp-5.2.2}/morp.egg-info/requires.txt +0 -0
- {morp-5.2.0 → morp-5.2.2}/morp.egg-info/top_level.txt +0 -0
- {morp-5.2.0 → morp-5.2.2}/setup.cfg +0 -0
- {morp-5.2.0 → morp-5.2.2}/setup.py +0 -0
|
@@ -138,11 +138,17 @@ class Dropfile(Interface):
|
|
|
138
138
|
# one thing we can do with an exclusive lock to tell other processes
|
|
139
139
|
# we have already looked at the file, I wish we could delete under an
|
|
140
140
|
# exclusive lock)
|
|
141
|
-
|
|
142
|
-
|
|
141
|
+
try:
|
|
142
|
+
if kwargs.get("truncate", True):
|
|
143
|
+
fp.truncate()
|
|
143
144
|
|
|
144
|
-
|
|
145
|
-
|
|
145
|
+
fcntl.flock(fp, fcntl.LOCK_UN)
|
|
146
|
+
fp.close()
|
|
147
|
+
|
|
148
|
+
except ValueError:
|
|
149
|
+
# .truncate - ValueError: truncate of closed file
|
|
150
|
+
# .flock - ValueError: I/O operation on closed file
|
|
151
|
+
pass
|
|
146
152
|
|
|
147
153
|
if kwargs.get("delete", True):
|
|
148
154
|
message.delete()
|
|
@@ -9,6 +9,7 @@ import boto3
|
|
|
9
9
|
from botocore.exceptions import ClientError
|
|
10
10
|
from botocore.credentials import RefreshableCredentials
|
|
11
11
|
from botocore.session import get_session
|
|
12
|
+
from datatypes import Datetime
|
|
12
13
|
|
|
13
14
|
from ..compat import *
|
|
14
15
|
from .base import Interface
|
|
@@ -82,6 +83,8 @@ class RefreshableSession(boto3.Session):
|
|
|
82
83
|
profile_name=self.connection_config.options.get("profile_name", None),
|
|
83
84
|
)
|
|
84
85
|
|
|
86
|
+
session_ttl = self.connection_config.options.get("session_ttl", 3600)
|
|
87
|
+
|
|
85
88
|
# if an sts arn is given, get credential by assuming given role
|
|
86
89
|
if arn := self.connection_config.options.get("arn", ""):
|
|
87
90
|
sts_client = session.client(
|
|
@@ -95,10 +98,7 @@ class RefreshableSession(boto3.Session):
|
|
|
95
98
|
"session_name",
|
|
96
99
|
"morp"
|
|
97
100
|
),
|
|
98
|
-
DurationSeconds=
|
|
99
|
-
"session_ttl",
|
|
100
|
-
3600
|
|
101
|
-
),
|
|
101
|
+
DurationSeconds=session_ttl,
|
|
102
102
|
).get("Credentials")
|
|
103
103
|
|
|
104
104
|
credentials = {
|
|
@@ -114,7 +114,7 @@ class RefreshableSession(boto3.Session):
|
|
|
114
114
|
"access_key": session_credentials.get("access_key"),
|
|
115
115
|
"secret_key": session_credentials.get("secret_key"),
|
|
116
116
|
"token": session_credentials.get("token"),
|
|
117
|
-
"expiry_time": Datetime(seconds=
|
|
117
|
+
"expiry_time": Datetime(seconds=session_ttl).isoformat(),
|
|
118
118
|
}
|
|
119
119
|
|
|
120
120
|
return credentials
|
|
@@ -294,13 +294,13 @@ class Message(object):
|
|
|
294
294
|
|
|
295
295
|
def ack(self):
|
|
296
296
|
"""Acknowledge this message has been processed"""
|
|
297
|
-
|
|
297
|
+
self.interface.ack(self.get_name(), self.to_interface())
|
|
298
298
|
|
|
299
299
|
def release(self, **kwargs):
|
|
300
300
|
"""Release this message back to the interface so another message instance
|
|
301
301
|
can pick it up
|
|
302
302
|
"""
|
|
303
|
-
|
|
303
|
+
self.interface.release(self.get_name(), self.to_interface(), **kwargs)
|
|
304
304
|
|
|
305
305
|
def release_later(self, delay_seconds):
|
|
306
306
|
"""If you want to release the message and not have it be visible for some
|
|
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
|