Permalink
Browse files

Muzzle warnings unless user attempts to use non-present feature.

  • Loading branch information...
1 parent 33527ad commit 2cc9558f611b469aa8598339c17fa4fd92ca8542 David Barts committed Aug 31, 2012
Showing with 6 additions and 6 deletions.
  1. +6 −6 bin/qless-py-worker
View
12 bin/qless-py-worker
@@ -4,15 +4,15 @@ import psutil
import argparse
def limit_memory(limit):
+ # Do nothing if no limit
+ if limit is None:
+ return
# Limits are not supported on systems that cannot impose them
try:
import resource
except ImportError:
logger.warn('Resource limits are not supported on this system.')
return
- # Do nothing if no limit
- if limit is None:
- return
# Strip off and remember any lettered suffix
if limit[-1] not in '0123456789':
mul = limit[-1].lower()
@@ -27,16 +27,16 @@ def limit_memory(limit):
resource.setrlimit(resource.RLIMIT_AS, (limit, limit))
def limit_cpu(limit):
+ # Do nothing if no limit
+ if limit is None:
+ return
# Limits are not supported on systems that cannot impose them
try:
import resource
except ImportError:
logger.warn('Resource limits are not supported on this system.')
return
import re
- # Do nothing if no limit
- if limit is None:
- return
# Try h:m:s first
matched = re.match(r'(\d+):(\d+):(\d+)', limit)
if matched:

0 comments on commit 2cc9558

Please sign in to comment.