Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
E
edx-platform
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
edx
edx-platform
Commits
cb2d8db5
Commit
cb2d8db5
authored
Jan 24, 2013
by
Brian Wilson
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
store files in S3 bucket in separate directories by mode
parent
20db3841
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
4 deletions
+7
-4
common/djangoapps/student/management/commands/pearson_transfer.py
+7
-4
No files found.
common/djangoapps/student/management/commands/pearson_transfer.py
View file @
cb2d8db5
...
...
@@ -111,7 +111,10 @@ class Command(BaseCommand):
with
dog_stats_api
.
timer
(
'pearson.{0}'
.
format
(
mode
),
tags
=
's3'
):
try
:
for
filename
in
os
.
listdir
(
files_from
):
upload_file_to_s3
(
bucket
,
files_from
,
filename
)
source_file
=
os
.
path
.
join
(
files_from
,
filename
)
# use mode as name of directory into which to write files
dest_file
=
os
.
path
.
join
(
mode
,
filename
)
upload_file_to_s3
(
bucket
,
source_file
,
dest_file
)
if
deleteAfterCopy
:
os
.
remove
(
files_from
+
'/'
+
filename
)
except
:
...
...
@@ -119,7 +122,7 @@ class Command(BaseCommand):
's3 archiving failed'
)
raise
def
upload_file_to_s3
(
bucket
,
source_
dir
,
filenam
e
):
def
upload_file_to_s3
(
bucket
,
source_
file
,
dest_fil
e
):
"""
Upload file to S3
"""
...
...
@@ -128,8 +131,8 @@ class Command(BaseCommand):
from
boto.s3.key
import
Key
b
=
s3
.
get_bucket
(
bucket
)
k
=
Key
(
b
)
k
.
key
=
"{filename}"
.
format
(
filename
=
filenam
e
)
k
.
set_contents_from_filename
(
os
.
path
.
join
(
source_dir
,
filename
)
)
k
.
key
=
"{filename}"
.
format
(
filename
=
dest_fil
e
)
k
.
set_contents_from_filename
(
source_file
)
def
export_pearson
():
options
=
{
'dest-from-settings'
:
True
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment