Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
P
pyfs
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
OpenEdx
pyfs
Commits
62b99816
Commit
62b99816
authored
Nov 16, 2009
by
rfkelly0
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
some performance tweaks for ConnectionManagerFS
parent
b5eefe94
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
8 additions
and
6 deletions
+8
-6
fs/__init__.py
+1
-1
fs/remote.py
+3
-0
fs/tests/__init__.py
+3
-1
fs/tests/test_remote.py
+1
-4
No files found.
fs/__init__.py
View file @
62b99816
...
@@ -15,7 +15,7 @@ implementations of this interface such as:
...
@@ -15,7 +15,7 @@ implementations of this interface such as:
"""
"""
__version__
=
"0.2.0a
8
"
__version__
=
"0.2.0a
9
"
__author__
=
"Will McGugan (will@willmcgugan.com)"
__author__
=
"Will McGugan (will@willmcgugan.com)"
# 'base' imports * from 'path' and 'errors', so their
# 'base' imports * from 'path' and 'errors', so their
...
...
fs/remote.py
View file @
62b99816
...
@@ -231,6 +231,9 @@ class ConnectionManagerFS(WrapFS):
...
@@ -231,6 +231,9 @@ class ConnectionManagerFS(WrapFS):
finally
:
finally
:
self
.
_connection_cond
.
release
()
self
.
_connection_cond
.
release
()
def
setcontents
(
self
,
path
,
data
):
self
.
wrapped_fs
.
setcontents
(
path
,
data
)
def
__getstate__
(
self
):
def
__getstate__
(
self
):
state
=
super
(
ConnectionManagerFS
,
self
)
.
__getstate__
()
state
=
super
(
ConnectionManagerFS
,
self
)
.
__getstate__
()
del
state
[
"_connection_cond"
]
del
state
[
"_connection_cond"
]
...
...
fs/tests/__init__.py
View file @
62b99816
...
@@ -597,6 +597,7 @@ class ThreadingTestCases:
...
@@ -597,6 +597,7 @@ class ThreadingTestCases:
if
self
.
fs
.
exists
(
subdir
):
if
self
.
fs
.
exists
(
subdir
):
self
.
fs
.
removedir
(
subdir
,
force
=
True
)
self
.
fs
.
removedir
(
subdir
,
force
=
True
)
self
.
assertFalse
(
self
.
fs
.
isdir
(
subdir
))
self
.
assertFalse
(
self
.
fs
.
isdir
(
subdir
))
self
.
assertTrue
(
self
.
fs
.
isdir
(
"/"
))
self
.
fs
.
makedir
(
subdir
)
self
.
fs
.
makedir
(
subdir
)
self
.
_yield
()
self
.
_yield
()
getattr
(
this
,
meth
)()
getattr
(
this
,
meth
)()
...
@@ -637,7 +638,8 @@ class ThreadingTestCases:
...
@@ -637,7 +638,8 @@ class ThreadingTestCases:
# One thread should succeed, two should error
# One thread should succeed, two should error
errors
=
[]
errors
=
[]
self
.
_runThreads
(
makedir
,
makedir
,
makedir
)
self
.
_runThreads
(
makedir
,
makedir
,
makedir
)
self
.
assertEquals
(
len
(
errors
),
2
)
if
len
(
errors
)
!=
2
:
raise
AssertionError
(
errors
)
self
.
fs
.
removedir
(
"testdir"
)
self
.
fs
.
removedir
(
"testdir"
)
# All threads should succeed
# All threads should succeed
errors
=
[]
errors
=
[]
...
...
fs/tests/test_remote.py
View file @
62b99816
...
@@ -74,20 +74,17 @@ class DisconnectingFS(WrapFS):
...
@@ -74,20 +74,17 @@ class DisconnectingFS(WrapFS):
self
.
_continue
=
False
self
.
_continue
=
False
self
.
_bounce_thread
.
join
()
self
.
_bounce_thread
.
join
()
self
.
_connected
=
True
self
.
_connected
=
True
self
.
wrapped_fs
.
close
()
super
(
DisconnectingFS
,
self
)
.
close
()
super
(
DisconnectingFS
,
self
)
.
close
()
def
disconnecting_wrapper
(
func
):
def
disconnecting_wrapper
(
func
):
"""Method wrapper to raise RemoteConnectionError if not connected."""
"""Method wrapper to raise RemoteConnectionError if not connected."""
if
func
.
__name__
==
"close"
:
return
func
@wraps
(
func
)
@wraps
(
func
)
def
wrapper
(
self
,
*
args
,
**
kwds
):
def
wrapper
(
self
,
*
args
,
**
kwds
):
if
not
self
.
_connected
:
if
not
self
.
_connected
:
raise
RemoteConnectionError
(
""
)
raise
RemoteConnectionError
(
""
)
return
func
(
self
,
*
args
,
**
kwds
)
return
func
(
self
,
*
args
,
**
kwds
)
return
wrapper
return
wrapper
DisconnectingFS
=
wrap_fs_methods
(
disconnecting_wrapper
)(
DisconnectingFS
)
DisconnectingFS
=
wrap_fs_methods
(
disconnecting_wrapper
,
DisconnectingFS
,
exclude
=
[
"close"
]
)
class
DisconnectRecoveryFS
(
WrapFS
):
class
DisconnectRecoveryFS
(
WrapFS
):
...
...
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