Esempio n. 1
0
    def get_state(self):
        """ 
        Get job state.

        :returns: (JobState object, sub-state string) tuple.

        >>> j = j_session.run_job({'remote_command' : '/bin/sleep', 'args' : ['100']})
        >>> ...
        >>> state,substate = j.get_state()
        >>> print(state)
        JobState.DONE
        """
        self.logger.debug('Retrieving state for job id {}'.format(self.id))
        drmaa2_lib = self.get_drmaa2_library()
        sub_state = POINTER(drmaa2_string)()
        sub_state.contents = drmaa2_string()
        jstate = drmaa2_lib.drmaa2_j_get_state(self._struct, sub_state)
        if jstate == int(JobState.UNSET_JSTATE):
            ExceptionMapper.check_last_error_code()
        return (JobState(jstate), sub_state.contents.value)
Esempio n. 2
0
 def fn():
     p = POINTER(c_double)()
     p.contents = c_double(6.1)
     return p.contents.value
Esempio n. 3
0
 def fn():
     p = POINTER(c_int)()
     assert not p
     p.contents = c_int(12)
     assert p
Esempio n. 4
0
if e is None and sys.platform == "darwin":
    try:
        e_path = utils.get_resource_filename("lib/libenchant.1.dylib")
    except (Error, ImportError):
        pass
    else:
        # Enchant doesn't natively support relocatable binaries on OSX.
        # We fake it by patching the enchant source to expose a char**, which
        # we can write the runtime path into ourselves.
        e = CDLL(e_path)
        try:
            e_dir = os.path.dirname(os.path.dirname(e_path))
            if isinstance(e_dir, str):
                e_dir = e_dir.encode(sys.getfilesystemencoding())
            prefix_dir = POINTER(c_char_p).in_dll(e, "enchant_prefix_dir_p")
            prefix_dir.contents = c_char_p(e_dir)
        except AttributeError:
            e = None

# Not found yet, search various standard system locations.
if e is None:
    for e_path in _e_path_possibilities():
        if e_path is not None:
            try:
                e = cdll.LoadLibrary(e_path)
            except OSError:
                pass
            else:
                break

# No usable enchant install was found :-(
Esempio n. 5
0
 def fn():
     p = POINTER(c_double)()
     p.contents = c_double(6.25)
     return p