Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
wrapper
Manage
Activity
Members
Labels
Automate
Agent sessions
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Terraform modules
Analyze
Contributor analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
elixxir
wrapper
Commits
5f13bc81
Commit
5f13bc81
authored
Oct 5, 2021
by
Jake Taylor
Browse files
Options
Downloads
Patches
Plain Diff
cleanup
parent
9b11cad5
No related branches found
No related tags found
1 merge request
!10
Release
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
wrapper.py
+3
-2
3 additions, 2 deletions
wrapper.py
with
3 additions
and
2 deletions
wrapper.py
+
3
−
2
View file @
5f13bc81
...
...
@@ -222,7 +222,8 @@ def cloudwatch_log(cloudwatch_log_group, log_file_path, id_path, log_file, clien
megabyte
=
1048576
# Size of one megabyte in bytes
max_size
=
100
*
megabyte
# Maximum log file size before truncation
push_frequency
=
30
# frequency of pushes to cloudwatch, in seconds
jitter_frequency
=
push_frequency
+
(
random
.
randint
(
-
1000
,
1000
)
/
1000
)
jitter_size
=
1000
# Variable time (in ms) for log push jitter
jitter_frequency
=
push_frequency
+
(
random
.
randint
(
-
jitter_size
,
jitter_size
)
/
1000
)
max_send_size
=
megabyte
# Event buffer and storage
...
...
@@ -248,7 +249,7 @@ def cloudwatch_log(cloudwatch_log_group, log_file_path, id_path, log_file, clien
is_time_to_push
=
time
.
time
()
-
last_push_time
>
jitter_frequency
if
(
is_over_max_size
or
is_time_to_push
)
and
len
(
log_events
)
>
0
:
jitter_frequency
=
push_frequency
+
(
random
.
randint
(
-
1000
,
1000
)
/
1000
)
jitter_frequency
=
push_frequency
+
(
random
.
randint
(
-
jitter_size
,
jitter_size
)
/
1000
)
# Send to cloudwatch, then reset events, size and push time
upload_sequence_token
,
ok
=
send
(
client
,
upload_sequence_token
,
log_events
,
log_stream_name
,
cloudwatch_log_group
)
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
sign in
to comment