Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
L
loosolab-s3
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
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
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
loosolab
software
loosolab-s3
Commits
b28f2d91
Commit
b28f2d91
authored
2 years ago
by
Philipp Goymann
Browse files
Options
Downloads
Patches
Plain Diff
add upload file counter
parent
4b8410bb
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
loosolab_s3/cmd.py
+6
-0
6 additions, 0 deletions
loosolab_s3/cmd.py
loosolab_s3/s3_functions.py
+2
-1
2 additions, 1 deletion
loosolab_s3/s3_functions.py
with
8 additions
and
1 deletion
loosolab_s3/cmd.py
+
6
−
0
View file @
b28f2d91
...
...
@@ -36,6 +36,10 @@ def run_s3_functions():
print
(
'
Bucket
'
+
args
.
bucketname
+
'
exists!
'
)
else
:
print
(
'
Bucket
'
+
args
.
bucketname
+
'
dont exists!
'
)
if
args
.
upload
:
utils
.
check_argparser
(
args
,
[
'
secret
'
,
"
key
"
,
"
files
"
,
"
bucketname
"
])
s3
.
upload_s3_objects
(
args
.
bucketname
,
args
.
files
)
#--------------------------------------------------------------------------------------------------------#
# parse command line arguments:
...
...
@@ -48,9 +52,11 @@ def argparsefunc():
parser
.
add_argument
(
"
--endpoint
"
,
help
=
"
URL S3
"
,
default
=
'
https://s3.mpi-bn.mpg.de
'
)
#actions
parser
.
add_argument
(
"
--upload
"
,
action
=
'
store_true
'
,
help
=
"
upload files to bucket
"
)
parser
.
add_argument
(
"
--bucket_exists
"
,
action
=
'
store_true
'
,
help
=
"
check if bucket exists
"
)
#values
parser
.
add_argument
(
"
--files
"
,
nargs
=
'
+
'
,
help
=
"
bucket upload files
"
)
parser
.
add_argument
(
"
--bucketname
"
)
parser
.
add_argument
(
"
--no_log
"
,
action
=
'
store_true
'
,
help
=
'
disable logging
'
)
...
...
This diff is collapsed.
Click to expand it.
loosolab_s3/s3_functions.py
+
2
−
1
View file @
b28f2d91
...
...
@@ -432,6 +432,7 @@ class Loosolab_s3:
if
not
self
.
check_s3_bucket_ex
(
bucket_name
):
self
.
__exception_log__
(
"
Bucket for upload does not exist!
"
)
return
count
=
1
for
local_file_name
in
file_list
:
try
:
file_name
=
os
.
path
.
basename
(
local_file_name
)
...
...
@@ -443,7 +444,7 @@ class Loosolab_s3:
else
:
self
.
transfer
.
upload_file
(
local_file_name
,
bucket_name
,
file_name
)
#self.session.Bucket(bucket_name).upload_file(local_file_name, file_name, Config=self.transfer)
self
.
logger
.
info
(
"
File
"
+
str
(
local_file_name
)
+
'
gets uploaded!
'
)
self
.
logger
.
info
(
"
File
"
+
str
(
local_file_name
)
+
'
gets uploaded!
'
+
str
(
count
)
+
'
of
'
+
str
(
len
(
file_list
))
)
except
Exception
as
e
:
self
.
__exception_log__
(
"
S3: Uploading files failed!
"
,
e
)
return
...
...
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