Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
nopaque
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Monitor
Service Desk
Analyze
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
SFB 1288 - INF
nopaque
Commits
ba778922
Commit
ba778922
authored
4 years ago
by
Patrick Jentsch
Browse files
Options
Downloads
Patches
Plain Diff
Create send_notification function
parent
ddee38e2
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
web/app/models.py
+2
-1
2 additions, 1 deletion
web/app/models.py
web/app/tasks/job_utils.py
+16
-16
16 additions, 16 deletions
web/app/tasks/job_utils.py
with
18 additions
and
17 deletions
web/app/models.py
+
2
−
1
View file @
ba778922
...
...
@@ -140,7 +140,8 @@ class User(UserMixin, db.Model):
@property
def
path
(
self
):
return
os
.
path
.
join
(
current_app
.
config
[
'
NOPAQUE_DATA_DIR
'
],
str
(
self
.
id
))
return
os
.
path
.
join
(
current_app
.
config
[
'
NOPAQUE_DATA_DIR
'
],
str
(
self
.
id
))
@property
def
password
(
self
):
...
...
This diff is collapsed.
Click to expand it.
web/app/tasks/job_utils.py
+
16
−
16
View file @
ba778922
...
...
@@ -41,13 +41,7 @@ def create_job_service(job):
else
:
job
.
status
=
'
queued
'
finally
:
msg
=
create_message
(
job
.
creator
.
email
,
'
Status update for your Job
"
{}
"'
.
format
(
job
.
title
),
'
tasks/email/notification
'
,
job
=
job
)
mail
.
send
(
msg
)
send_notification
(
job
)
def
checkout_job_service
(
job
):
...
...
@@ -85,8 +79,6 @@ def checkout_job_service(job):
+
'
Details: {}
'
.
format
(
e
))
return
else
:
job
.
end_date
=
datetime
.
utcnow
()
job
.
status
=
task_state
if
task_state
==
'
complete
'
:
job_results_dir
=
os
.
path
.
join
(
job
.
path
,
'
output
'
)
job_results
=
filter
(
lambda
x
:
x
.
endswith
(
'
.zip
'
),
...
...
@@ -94,14 +86,10 @@ def checkout_job_service(job):
for
job_result
in
job_results
:
job_result
=
JobResult
(
filename
=
job_result
,
job
=
job
)
db
.
session
.
add
(
job_result
)
job
.
end_date
=
datetime
.
utcnow
()
job
.
status
=
task_state
finally
:
msg
=
create_message
(
job
.
creator
.
email
,
'
Status update for your Job
"
{}
"'
.
format
(
job
.
title
),
'
tasks/email/notification
'
,
job
=
job
)
mail
.
send
(
msg
)
send_notification
(
job
)
def
remove_job_service
(
job
):
...
...
@@ -134,3 +122,15 @@ def remove_job_service(job):
logging
.
error
(
'
Remove
"
{}
"
service raised
'
.
format
(
service_name
)
# noqa
+
'
[docker-APIError] The server returned an error.
'
# noqa
+
'
Details: {}
'
.
format
(
e
))
def
send_notification
(
job
):
if
job
.
creator
.
setting_job_status_mail_notifications
==
'
none
'
:
return
if
(
job
.
creator
.
setting_job_status_mail_notifications
==
'
end
'
and
job
.
status
not
in
[
'
complete
'
,
'
failed
'
]):
return
msg
=
create_message
(
job
.
creator
.
email
,
'
Status update for your Job
"
{}
"'
.
format
(
job
.
title
),
'
tasks/email/notification
'
,
job
=
job
)
mail
.
send
(
msg
)
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
register
or
sign in
to comment