⚲
Project
General
Profile
Sign in
Register
Home
Projects
Help
Search
:
rgw
All Projects
Ceph
»
rgw
Overview
Activity
Roadmap
Issues
Spent time
Gantt
Download (873 Bytes)
Feature #65131
ยป put-test.py
Paul Cuzner
, 03/27/2024 12:34 AM
#!/usr/bin/env python3
# to create the random data : dd if=/dev/random of=random-data bs=1M count=64
import
boto3
# type: ignore
import
time
import
os
ACCESS_KEY
=
os
.
getenv
(
'
ACCESS_KEY
'
)
SECRET_KEY
=
os
.
getenv
(
'
SECRET_KEY
'
)
ENDPOINT
=
os
.
getenv
(
'
ENDPOINT
'
)
s3
=
boto3
.
resource
(
'
s3
'
,
endpoint_url
=
ENDPOINT
,
aws_access_key_id
=
ACCESS_KEY
,
aws_secret_access_key
=
SECRET_KEY
)
bucket
=
s3
.
Bucket
(
'
boto-2
'
)
bucket
.
create
()
interval
=
5
ctr
=
1
ops
=
0
now
=
time
.
time
()
next_interval
=
now
+
interval
try
:
while
True
:
bucket
.
upload_file
(
Filename
=
'
random-data
'
,
Key
=
f
"
object_
{
ctr
}
"
)
ops
+=
1
ctr
+=
1
now
=
time
.
time
()
if
now
>
next_interval
:
next_interval
=
now
+
interval
print
(
f
"
{
int
(
time
.
time
())
}
,
{
ops
}
"
)
ops
=
0
except
KeyboardInterrupt
:
pass
(1-1/1)
Loading...