Exemplo n.º 1
0
Arquivo: feed.py Projeto: daasara/riba
 def _init_sync(self):
     ''' create a sync event to store the info about this sync '''
     sync = SyncEvent()
     sync.started_at = datetime.now()
     sync.account = self.config['ACCOUNT']
     sync.save(using='default')
     return sync
Exemplo n.º 2
0
sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
sockfd = sock.fileno()
SIOCGIFADDR = 0x8915

def get_ip(iface = 'eth0'):
    ifreq = struct.pack('16sH14s', iface, socket.AF_INET, '\x00'*14)
    try:
        res = fcntl.ioctl(sockfd, SIOCGIFADDR, ifreq)
    except:
        return None
    ip = struct.unpack('16sH2x4s8x', res)[2]
    return socket.inet_ntoa(ip)

if __name__ == '__main__':
    sync = SyncEvent()
    sync.account = 'Futurebazaar New Arrivals'
    sync.status = 'running'
    sync.started_at = datetime.now()
    sync.save()
    try:
        compute(sync)
        sync.status = 'finished'
    except Exception,e:
        sync.status = 'dead'
        import traceback
        import sys
        exc_info = sys.exc_info()
        st = '\n'.join(traceback.format_exception(*(exc_info or sys.exc_info())))
        sync.stack_trace = st
        sync.status = 'dead'
Exemplo n.º 3
0
sockfd = sock.fileno()
SIOCGIFADDR = 0x8915


def get_ip(iface='eth0'):
    ifreq = struct.pack('16sH14s', iface, socket.AF_INET, '\x00' * 14)
    try:
        res = fcntl.ioctl(sockfd, SIOCGIFADDR, ifreq)
    except:
        return None
    ip = struct.unpack('16sH2x4s8x', res)[2]
    return socket.inet_ntoa(ip)


if __name__ == '__main__':
    sync = SyncEvent()
    sync.account = 'Tinla Compute Daily Order Count'
    sync.status = 'running'
    sync.started_at = datetime.now()
    sync.save()
    try:
        compute(sync)
        sync.status = 'finished'
    except Exception, e:
        sync.status = 'dead'
        import traceback
        import sys
        exc_info = sys.exc_info()
        st = '\n'.join(
            traceback.format_exception(*(exc_info or sys.exc_info())))
        sync.stack_trace = st
Exemplo n.º 4
0
sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
sockfd = sock.fileno()
SIOCGIFADDR = 0x8915

def get_ip(iface = 'eth0'):
    ifreq = struct.pack('16sH14s', iface, socket.AF_INET, '\x00'*14)
    try:
        res = fcntl.ioctl(sockfd, SIOCGIFADDR, ifreq)
    except:
        return None
    ip = struct.unpack('16sH2x4s8x', res)[2]
    return socket.inet_ntoa(ip)

if __name__ == '__main__':
    sync = SyncEvent()
    sync.account = 'Tinla Compute Daily Order Count'
    sync.status = 'running'
    sync.started_at = datetime.now()
    sync.save()
    try:
        compute(sync)
        sync.status = 'finished'
    except Exception,e:
        sync.status = 'dead'
        import traceback
        import sys
        exc_info = sys.exc_info()
        st = '\n'.join(traceback.format_exception(*(exc_info or sys.exc_info())))
        sync.stack_trace = st
        sync.status = 'dead'
Exemplo n.º 5
0
sockfd = sock.fileno()
SIOCGIFADDR = 0x8915


def get_ip(iface='eth0'):
    ifreq = struct.pack('16sH14s', iface, socket.AF_INET, '\x00' * 14)
    try:
        res = fcntl.ioctl(sockfd, SIOCGIFADDR, ifreq)
    except:
        return None
    ip = struct.unpack('16sH2x4s8x', res)[2]
    return socket.inet_ntoa(ip)


if __name__ == '__main__':
    sync = SyncEvent()
    sync.account = 'Futurebazaar New Arrivals'
    sync.status = 'running'
    sync.started_at = datetime.now()
    sync.save()
    try:
        compute(sync)
        sync.status = 'finished'
    except Exception, e:
        sync.status = 'dead'
        import traceback
        import sys
        exc_info = sys.exc_info()
        st = '\n'.join(
            traceback.format_exception(*(exc_info or sys.exc_info())))
        sync.stack_trace = st