Skip to content

Commit 9056944

Browse files
committed
Merge pull request #1 from EducationalTestingService/master
Python 3 compatibility and version 0.6 bump
2 parents cd25815 + 082b13b commit 9056944

4 files changed

Lines changed: 34 additions & 33 deletions

File tree

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
# drmaa-python
22

3-
DRMAA bindings for Python
3+
DRMAA bindings for Python. Now Python 3 compatible.
44

drmaa/__init__.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,9 @@
3030
import ctypes as _ct
3131

3232
try:
33-
import namedtuple as _nt
33+
from collections import namedtuple
3434
except ImportError: # pre 2.6 behaviour
35-
import nt as _nt
35+
from drmaa.nt import namedtuple
3636

3737
__version__ = "$Revision$"[11:-2]
3838

@@ -68,10 +68,10 @@
6868
OutOfMemoryException,)
6969

7070
Version = _h.Version
71-
JobInfo = _nt.namedtuple("JobInfo",
71+
JobInfo = namedtuple("JobInfo",
7272
"""jobId hasExited hasSignal terminatedSignal
7373
hasCoreDump wasAborted exitStatus resourceUsage""")
74-
# FileTransferMode = _nt.namedtuple("FileTransferMode",
74+
# FileTransferMode = namedtuple("FileTransferMode",
7575
# """transferInputStream transferOutputStream
7676
# transferErrorStream""")
7777

@@ -359,7 +359,7 @@ def runBulkJobs(jobTemplate, beginIndex, endIndex, step):
359359
@staticmethod
360360
def control(jobId, operation):
361361
"""\
362-
Used to hold, release, suspend, resume, or kill the job identified by jobId.
362+
Used to hold, release, suspend, resume, or kill the job identified by jobId.
363363
364364
:Parameters:
365365
jobId : string
@@ -429,7 +429,7 @@ def synchronize(jobIds, timeout=-1, dispose=False):
429429
timeout has elapsed, all the jobs have been waited on or there was an
430430
interrupt. If the invocation exits on timeout, an ExitTimeoutException
431431
is thrown. The caller should check system time before and after this
432-
call in order to be sure of how much time has passed.
432+
call in order to be sure of how much time has passed.
433433
"""
434434
if dispose: d = 1
435435
else: d = 0
@@ -439,7 +439,7 @@ def synchronize(jobIds, timeout=-1, dispose=False):
439439
@staticmethod
440440
def wait(jobId, timeout=-1):
441441
"""\
442-
Wait for a job with jobId to finish execution or fail.
442+
Wait for a job with jobId to finish execution or fail.
443443
444444
:Parameters:
445445
`jobId` : str
@@ -449,7 +449,7 @@ def wait(jobId, timeout=-1):
449449
jobId, this routine will wait for any job from the session
450450
`timeout` : float
451451
The timeout value is used to specify the desired behavior when a
452-
result is not immediately available.
452+
result is not immediately available.
453453
454454
The value `Session.TIMEOUT_WAIT_FOREVER` may be specified to wait
455455
indefinitely for a result. The value `Session.TIMEOUT_NO_WAIT` may

drmaa/helpers.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,9 @@
2929
_BUFLEN=const.ATTR_BUFFER
3030

3131
try:
32-
import namedtuple as _nt
32+
from collections import namedtuple
3333
except ImportError: # pre 2.6 behaviour
34-
import nt as _nt
34+
from drmaa.nt import namedtuple
3535

3636
class BoolConverter(object):
3737
"""Helper class to convert to/from bool attributes."""
@@ -66,7 +66,7 @@ def __get__(self, *args):
6666
c(self._f, buf, _ct.sizeof(buf))
6767
return buf.value
6868

69-
Version = _nt.namedtuple("Version", "major minor")
69+
Version = namedtuple("Version", "major minor")
7070
Version.__str__ = lambda x: "%s.%s" % (x.major, x.minor)
7171
#Version.__doc__ = """\
7272
#An object representing the DRMAA version.
@@ -105,7 +105,7 @@ def __set__(self, instance, value):
105105
c(drmaa_set_attribute, instance, self.name, v)
106106
def __get__(self, instance, _):
107107
attr_buffer = create_string_buffer(const.ATTR_BUFFER)
108-
c(drmaa_get_attribute, instance, self.name,
108+
c(drmaa_get_attribute, instance, self.name,
109109
attr_buffer, sizeof(attr_buffer))
110110
if self.converter:
111111
return self.converter.from_drmaa(attr_buffer.value)
@@ -114,7 +114,7 @@ def __get__(self, instance, _):
114114

115115
class VectorAttribute(object):
116116
"""\
117-
A DRMAA attribute representing a list.
117+
A DRMAA attribute representing a list.
118118
119119
To be managed with vector C DRMAA attribute management functions."""
120120
def __init__(self, name):
@@ -133,7 +133,7 @@ class DictAttribute(object):
133133
def __init__(self, name):
134134
self.name = name
135135
def __set__(self, instance, value):
136-
v = [ "%s=%s" % (k, v) for (k, v) in value.iteritems() ]
136+
v = [ "%s=%s" % (k, v) for (k, v) in value.items() ]
137137
c(drmaa_set_vector_attribute, instance, self.name, string_vector(v))
138138
def __get__(self, instance, _):
139139
x = [ i.split('=', 1) for i in list(vector_attribute_iterator(

setup.py

Lines changed: 19 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,21 @@
11
# -----------------------------------------------------------
2-
# Copyright (C) 2009 StatPro Italia s.r.l.
3-
#
4-
# StatPro Italia
5-
# Via G. B. Vico 4
6-
# I-20123 Milano
7-
# ITALY
8-
#
9-
# phone: +39 02 96875 1
10-
# fax: +39 02 96875 605
11-
#
12-
# This program is distributed in the hope that it will be
13-
# useful, but WITHOUT ANY WARRANTY; without even the
14-
# warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
15-
# PURPOSE. See the license for more details.
2+
# Copyright (C) 2009 StatPro Italia s.r.l.
3+
#
4+
# StatPro Italia
5+
# Via G. B. Vico 4
6+
# I-20123 Milano
7+
# ITALY
8+
#
9+
# phone: +39 02 96875 1
10+
# fax: +39 02 96875 605
11+
#
12+
# This program is distributed in the hope that it will be
13+
# useful, but WITHOUT ANY WARRANTY; without even the
14+
# warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
15+
# PURPOSE. See the license for more details.
1616
# -----------------------------------------------------------
17-
#
18-
# Author: Enrico Sirola <enrico.sirola@statpro.com>
17+
#
18+
# Author: Enrico Sirola <enrico.sirola@statpro.com>
1919

2020
from setuptools import setup, find_packages
2121

@@ -24,7 +24,7 @@
2424

2525
setup(
2626
name="drmaa",
27-
version="0.5",
27+
version="0.6",
2828
packages=packages,
2929
package_data=package_data,
3030
author="Enrico Sirola",
@@ -44,8 +44,9 @@
4444
Intended Audience :: Science/Research
4545
License :: OSI Approved :: BSD License
4646
Programming Language :: Python :: 2
47+
Programming Language :: Python :: 3
4748
Topic :: Software Development :: Libraries :: Python Modules
4849
Topic :: System :: Distributed Computing""".split('\n'),
4950
)
50-
51+
5152

0 commit comments

Comments
 (0)