def __init__(self, trg_queue, item_id, max_tries=None, ttl=None,
                 lock=None, no_open=False, host=None):

        self.id = item_id
        self.queue = trg_queue
        self.max_tries = _c.FSQ_MAX_TRIES if max_tries is None else max_tries
        self.ttl = _c.FSQ_TTL if ttl is None else ttl
        self.lock = _c.FSQ_LOCK if lock is None else lock
        self.item = None
        self.host = host

        # open file immediately
        if not no_open:
            self.open()
        try:
            self.delimiter, arguments = deconstruct(item_id)
            try:
                # construct datetime.datetime from enqueued_at
                self.enqueued_at = datetime.datetime.strptime(arguments[0],
                                                              _c.FSQ_TIMEFMT)
                self.entropy = arguments[1]
                self.pid = arguments[2]
                self.hostname = arguments[3]
                self.tries = arguments[4]
                self.arguments = tuple(arguments[5:])
            except IndexError, e:
                raise FSQMalformedEntryError(errno.EINVAL, u'needed at least'\
                                             u' 4 arguments to unpack, got:'\
                                             u' {0}'.format(len(arguments)))
            except ValueError, e:
                raise FSQTimeFmtError(errno.EINVAL, u'invalid date string'\
                                      u' for strptime fmt {0}:'\
                                      u' {1}'.format(_c.FSQ_TIMEFMT,
                                                     arguments[0]))
            try:
                self.tries = int(self.tries)
            except ValueError, e:
                raise FSQTimeFmtError(errno.EINVAL, u'tries must be an int,'\
                                      u' not {0}: {1}'.format(
                                        self.tries.__class__.__name__,
                                        self.tries))
            try:
                check_ttl_max_tries(self.tries, self.enqueued_at,
                                    self.max_tries, self.ttl)
            except (FSQMaxTriesError, FSQTTLExpiredError, ), e:
                e.strerror = u': '.join([
                    e.strerror,
                    u'for item {0}; failed permanently'.format(self.id),
                ])
                raise e
        except Exception, e:
            try:
                # unhandled exceptions are perm failures
                self.fail_perm()
            finally:
                self.close()
            raise e
Service txes data
dataset/ETHPy150Open axialmarket/fsq/fsq/items.py/FSQWorkItem.__init__--crossover with--dataset/ETHPy150Open ioflo/ioflo/ioflo/aio/serial/serialing.py/Driver.serviceTxes