Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
N
NACSOS Core
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
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
MCC APSIS
NACSOS
NACSOS Core
Commits
d9c71661
Commit
d9c71661
authored
2 years ago
by
Tim Repke
Browse files
Options
Downloads
Patches
Plain Diff
fix mypy round2
parent
3c86151d
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
server/api/routes/imports.py
+3
-4
3 additions, 4 deletions
server/api/routes/imports.py
server/util/events/hooks/imports.py
+6
-2
6 additions, 2 deletions
server/util/events/hooks/imports.py
with
9 additions
and
6 deletions
server/api/routes/imports.py
+
3
−
4
View file @
d9c71661
...
@@ -29,9 +29,8 @@ async def get_all_imports_for_project(permissions: UserPermissions = Depends(Use
...
@@ -29,9 +29,8 @@ async def get_all_imports_for_project(permissions: UserPermissions = Depends(Use
async
def
get_import_details
(
import_id
:
str
,
async
def
get_import_details
(
import_id
:
str
,
permissions
:
UserPermissions
=
Depends
(
UserPermissionChecker
(
'
imports_read
'
)))
\
permissions
:
UserPermissions
=
Depends
(
UserPermissionChecker
(
'
imports_read
'
)))
\
->
ImportModel
:
->
ImportModel
:
import_details
=
await
read_import
(
import_id
=
import_id
,
import_details
=
await
read_import
(
import_id
=
import_id
,
engine
=
db_engine
)
engine
=
db_engine
)
if
import_details
is
not
None
and
str
(
import_details
.
project_id
)
==
str
(
permissions
.
permissions
.
project_id
):
if
str
(
import_details
.
project_id
)
==
str
(
permissions
.
permissions
.
project_id
):
return
import_details
return
import_details
raise
InsufficientPermissions
(
'
You do not have permission to access this information.
'
)
raise
InsufficientPermissions
(
'
You do not have permission to access this information.
'
)
...
@@ -59,7 +58,7 @@ async def trigger_import(import_id: str,
...
@@ -59,7 +58,7 @@ async def trigger_import(import_id: str,
permissions
:
UserPermissions
=
Depends
(
UserPermissionChecker
(
'
imports_edit
'
))):
permissions
:
UserPermissions
=
Depends
(
UserPermissionChecker
(
'
imports_edit
'
))):
import_details
=
await
read_import
(
import_id
=
import_id
,
engine
=
db_engine
)
import_details
=
await
read_import
(
import_id
=
import_id
,
engine
=
db_engine
)
if
str
(
import_details
.
project_id
)
==
str
(
permissions
.
permissions
.
project_id
):
if
import_details
is
not
None
and
str
(
import_details
.
project_id
)
==
str
(
permissions
.
permissions
.
project_id
):
if
import_details
.
type
==
ImportType
.
jsonl
:
if
import_details
.
type
==
ImportType
.
jsonl
:
await
submit_jsonl_import_task
(
import_id
=
import_id
,
await
submit_jsonl_import_task
(
import_id
=
import_id
,
base_url
=
settings
.
PIPES
.
API_URL
,
base_url
=
settings
.
PIPES
.
API_URL
,
...
...
This diff is collapsed.
Click to expand it.
server/util/events/hooks/imports.py
+
6
−
2
View file @
d9c71661
...
@@ -30,12 +30,16 @@ async def update_import_status(event: PipelineTaskStatusChangedEvent):
...
@@ -30,12 +30,16 @@ async def update_import_status(event: PipelineTaskStatusChangedEvent):
# Seems like task was started, remember the time
# Seems like task was started, remember the time
if
event
.
status
==
'
RUNNING
'
and
import_details
.
time_started
is
None
:
if
event
.
status
==
'
RUNNING
'
and
import_details
.
time_started
is
None
:
logger
.
debug
(
f
'
Updating import start time for
{
import_details
.
import_id
}
'
)
logger
.
debug
(
# type: ignore[unreachable]
f
'
Updating import start time for
{
import_details
.
import_id
}
'
)
import_details
.
time_started
=
datetime
.
now
()
import_details
.
time_started
=
datetime
.
now
()
await
session
.
commit
()
await
session
.
commit
()
elif
(
event
.
status
==
'
COMPLETED
'
or
event
.
status
==
'
FAILED
'
or
event
.
status
==
'
CANCELLED
'
)
\
elif
(
event
.
status
==
'
COMPLETED
'
or
event
.
status
==
'
FAILED
'
or
event
.
status
==
'
CANCELLED
'
)
\
and
import_details
.
time_finished
is
None
:
and
import_details
.
time_finished
is
None
:
logger
.
debug
(
f
'
Updating import finish time for
{
import_details
.
import_id
}
'
)
logger
.
debug
(
# type: ignore[unreachable]
f
'
Updating import finish time for
{
import_details
.
import_id
}
'
)
import_details
.
time_finished
=
datetime
.
now
()
import_details
.
time_finished
=
datetime
.
now
()
await
session
.
commit
()
await
session
.
commit
()
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