Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
D-GENIES
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
Container Registry
Model registry
Operate
Environments
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
Admin message
A compter du 1er avril, attention à vos pipelines :
Nouvelles limitations de Docker Hub
Show more breadcrumbs
genotoul-bioinfo
d-genies
D-GENIES
Commits
eea79ad9
Commit
eea79ad9
authored
7 years ago
by
Floreal Cabanettes
Browse files
Options
Downloads
Patches
Plain Diff
Check file size in ava mode
parent
baac9880
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
application.properties
+2
-0
2 additions, 0 deletions
application.properties
src/dgenies/config_reader.py
+16
-0
16 additions, 0 deletions
src/dgenies/config_reader.py
src/dgenies/lib/job_manager.py
+6
-3
6 additions, 3 deletions
src/dgenies/lib/job_manager.py
with
24 additions
and
3 deletions
application.properties
+
2
−
0
View file @
eea79ad9
...
...
@@ -12,6 +12,8 @@ web_url = http://localhost:5000
# Max size of uploaded files (also for files from URL, size uncompressed):
# Please set the unit: M for Megabyte or G for Gigabyte (-1 without unit to don't set a limit)
max_upload_size
=
3G
# Max upload file size for all-vs-all (only target):
max_upload_size_ava
=
1G
# Max upload file size (compressed or not, only for uploaded files, not from URL):
# Please set the unit: M for Megabyte or G for Gigabyte (-1 without unit to don't set a limit)
max_upload_file_size
=
1G
...
...
This diff is collapsed.
Click to expand it.
src/dgenies/config_reader.py
+
16
−
0
View file @
eea79ad9
...
...
@@ -102,6 +102,22 @@ class AppConfigReader:
except
NoOptionError
:
return
-
1
def
_get_max_upload_size_ava
(
self
):
try
:
max_size_b
=
self
.
_replace_vars
(
self
.
reader
.
get
(
"
global
"
,
"
max_upload_size_ava
"
))
if
max_size_b
==
"
-1
"
:
return
-
1
size_v
=
float
(
max_size_b
[:
-
1
])
size_unit
=
max_size_b
[
-
1
].
upper
()
if
size_unit
not
in
[
"
M
"
,
"
G
"
]:
raise
ValueError
(
"
Max size unit must be M or G
"
)
max_size
=
int
(
size_v
*
1024
*
1024
)
if
size_unit
==
"
G
"
:
max_size
*=
1024
return
max_size
except
NoOptionError
:
return
-
1
def
_get_max_upload_file_size
(
self
):
try
:
max_size_b
=
self
.
_replace_vars
(
self
.
reader
.
get
(
"
global
"
,
"
max_upload_file_size
"
))
...
...
This diff is collapsed.
Click to expand it.
src/dgenies/lib/job_manager.py
+
6
−
3
View file @
eea79ad9
...
...
@@ -433,22 +433,25 @@ class JobManager:
:param max_upload_size_readable: max upload size human readable
:return: (True if correct, True if error set [for fail], True if should be local)
"""
if
input_type
==
"
target
"
and
self
.
query
is
None
:
max_upload_size_readable
=
self
.
config
.
max_upload_size_ava
/
1024
/
1024
with
Job
.
connect
():
my_input
=
getattr
(
self
,
input_type
)
if
my_input
.
get_path
().
endswith
(
"
.gz
"
)
and
not
self
.
is_gz_file
(
my_input
.
get_path
()):
# Check file is correctly gzipped
job
=
Job
.
get
(
Job
.
id_job
==
self
.
id_job
)
job
.
status
=
"
fail
"
job
.
error
=
"
Query
file is not a correct gzip file
"
job
.
error
=
input_type
+
"
file is not a correct gzip file
"
job
.
save
()
self
.
clear
()
return
False
,
True
,
None
# Check size:
file_size
=
self
.
get_file_size
(
my_input
.
get_path
())
if
-
1
<
self
.
config
.
max_upload_size
<
file_size
:
if
-
1
<
(
self
.
config
.
max_upload_size
if
(
input_type
==
"
query
"
or
self
.
query
is
not
None
)
else
self
.
config
.
max_upload_size_ava
)
<
file_size
:
job
=
Job
.
get
(
Job
.
id_job
==
self
.
id_job
)
job
.
status
=
"
fail
"
job
.
error
=
"
Query
file exceed size limit of %d Mb (uncompressed)
"
%
max_upload_size_readable
job
.
error
=
input_type
+
"
file exceed size limit of %d Mb (uncompressed)
"
%
max_upload_size_readable
job
.
save
()
self
.
clear
()
return
False
,
True
,
None
...
...
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