Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
C
core
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to JiHu GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Chenhao Ma
core
Commits
c5a0daa4
Commit
c5a0daa4
authored
9 years ago
by
Kevin S. Hahn
Browse files
Options
Downloads
Patches
Plain Diff
rejects uploads that split session across projects
parent
e8aa9bfe
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
util.py
+8
-1
8 additions, 1 deletion
util.py
with
8 additions
and
1 deletion
util.py
+
8
−
1
View file @
c5a0daa4
...
...
@@ -53,6 +53,8 @@ def insert_file(dbc, _id, file_info, filepath, digest, data_path, quarantine_pat
log
.
info
(
'
Sorting %s
'
%
filename
)
_id
=
_update_db
(
dbc
.
database
,
dataset
)
if
not
_id
:
return
400
,
'
Session exists in different project
'
file_spec
=
dict
(
_id
=
_id
,
files
=
{
'
$elemMatch
'
:
{
...
...
@@ -103,7 +105,12 @@ def _update_db(db, dataset):
session_spec
=
{
'
uid
'
:
dataset
.
nims_session_id
}
session
=
db
.
sessions
.
find_one
(
session_spec
,
[
'
project
'
])
if
session
:
# skip project creation, if session exists
project
=
db
.
projects
.
find_one
({
'
_id
'
:
session
[
'
project
'
]},
fields
=
PROJECTION_FIELDS
)
project
=
db
.
projects
.
find_one
({
'
_id
'
:
session
[
'
project
'
]},
fields
=
PROJECTION_FIELDS
+
[
'
name
'
])
#TODO:the session must belong to the specified group/project, or not exist at all
# if the session exists, for a different group/project, reject the hell out of it.
# a single session cannot be split between two different projects
if
project
[
'
name
'
]
!=
dataset
.
nims_project
:
return
None
else
:
existing_group_ids
=
[
g
[
'
_id
'
]
for
g
in
db
.
groups
.
find
(
None
,
[
'
_id
'
])]
group_id_matches
=
difflib
.
get_close_matches
(
dataset
.
nims_group_id
,
existing_group_ids
,
cutoff
=
0.8
)
...
...
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