Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
S
sdo-grading-job-snatcher
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
shared
sdo-grading-job-snatcher
Commits
7b14ae10
Commit
7b14ae10
authored
Oct 02, 2025
by
Fredrik Wendt
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Make wrapper only snatch every 4th grading work
parent
f7c124ec
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
2 deletions
+11
-2
wrapper.py
wrapper.py
+11
-2
No files found.
wrapper.py
View file @
7b14ae10
...
@@ -13,6 +13,8 @@ development_mode = os.getenv('PYCHARM_HOSTED')
...
@@ -13,6 +13,8 @@ development_mode = os.getenv('PYCHARM_HOSTED')
def
main
():
def
main
():
log
=
logging
.
getLogger
(
'wrapper'
)
log
=
logging
.
getLogger
(
'wrapper'
)
messages_seen
=
[]
log
.
info
(
"Running main"
)
log
.
info
(
"Running main"
)
host
=
'localhost'
if
development_mode
else
'redis.wendt.vpn'
host
=
'localhost'
if
development_mode
else
'redis.wendt.vpn'
try
:
try
:
...
@@ -40,8 +42,15 @@ def main():
...
@@ -40,8 +42,15 @@ def main():
subject
=
data
[
"headers"
][
"subject"
]
subject
=
data
[
"headers"
][
"subject"
]
log
.
info
(
f
"Subject: {subject}"
)
log
.
info
(
f
"Subject: {subject}"
)
if
"III Grading Required"
in
subject
:
if
"III Grading Required"
in
subject
:
log
.
info
(
"Subject found - let's go snatching!"
)
if
len
(
messages_seen
)
==
0
:
snatch_grading_work
()
log
.
info
(
"Subject found - let's go snatching!"
)
snatch_grading_work
()
else
:
log
.
info
(
"Not snatching this one, only every 4th"
)
messages_seen
.
append
(
message
)
if
len
(
messages_seen
)
==
4
:
log
.
info
(
"Clearing message log, snatching the next one"
)
messages_seen
=
[]
else
:
else
:
log
.
info
(
"Ignoring this email"
)
log
.
info
(
"Ignoring this email"
)
except
Exception
as
e
:
except
Exception
as
e
:
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment