Exemple #1
0
 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
Exemple #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'
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
Exemple #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'
Exemple #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