Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
I
insights
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
insights
Commits
304c34ef
Commit
304c34ef
authored
Mar 30, 2013
by
Piotr Mitros
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
s3fs is tested and working. Worth a benchmark on AWS.
parent
3e2036d6
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
4 deletions
+6
-4
src/djanalytics/modulefs/modulefs.py
+6
-4
No files found.
src/djanalytics/modulefs/modulefs.py
View file @
304c34ef
...
...
@@ -9,13 +9,13 @@ from models import FSExpirations
if
settings
.
DJFS
[
'type'
]
==
'osfs'
:
from
fs.osfs
import
OSFS
elif
settings
.
DJFS
[
'type'
]
==
's
f3
s'
:
elif
settings
.
DJFS
[
'type'
]
==
's
3f
s'
:
from
fs.s3fs
import
S3FS
from
boto.s3.connection
import
S3Connection
from
boto.s3.key
import
Key
s3conn
=
S3Connection
()
else
:
raise
AttributeError
(
"Bad filesystem
"
)
raise
AttributeError
(
"Bad filesystem
: "
+
str
(
settings
.
DJFS
[
'type'
])
)
def
get_filesystem
(
namespace
):
''' Returns a pyfilesystem for static module storage.
...
...
@@ -26,8 +26,10 @@ def get_filesystem(namespace):
'''
if
settings
.
DJFS
[
'type'
]
==
'osfs'
:
return
get_osfs
(
namespace
)
elif
settings
.
DJFS
[
'type'
]
==
's3fs'
:
return
get_s3fs
(
namespace
)
else
:
raise
AttributeError
(
"Bad filesystem
"
)
raise
AttributeError
(
"Bad filesystem
: "
+
str
(
settings
.
DJFS
[
'type'
])
)
def
expire_objects
():
''' Remove all obsolete objects from the file systems. Untested. '''
...
...
@@ -91,6 +93,6 @@ def get_s3fs(namespace):
s3conn
=
S3Connection
()
return
s3conn
.
generate_s3_url
(
timeout
,
'GET'
,
bucket
=
settings
.
DJFS
[
'bucket'
],
key
=
filename
)
s3fs
=
patch
fs
(
fs
,
namespace
,
get_s3_url
)
s3fs
=
patch
_fs
(
s3
fs
,
namespace
,
get_s3_url
)
return
s3fs
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