コード例 #1
0
    def runJob(self, query):
        if(query == None) :
            return False

        version = str(36.0)

        name = 'LoanStatusPrediction'   #'Regex'
        # sdata = {'Name':  name,
        #          'Query': query,
        #          'ApiVersion': version,
        #          'NotifyForOperationCreate': 'true',
        #          'NotifyForFields': 'Referenced'
        #          }
        # topicId = self.create_record('PushTopic', sdata, self.sf)['id']
        # print topicId
        url = 'https://' + self.sf.sf_instance.encode()
        # print 'base url : ' + url
        client = BayeuxClient(url + '/cometd/' + version, 'OAuth ' + self.sf.session_id)
        # print "737373"
        client.register('/topic/' + name, self.record_analysis)
        # client.register('/chat/demo', cb)
        try:
            client.start()

            while True:
                pass
            # self.delete_record('PushTopic', topicId)

        except Exception as e:
            print str(e)
コード例 #2
0
def main():
	logging.basicConfig(level=logging.INFO)
	client = BayeuxClient('http://localhost:8080/cometd')
	client.register('/members/demo', cb)
	client.register('/chat/demo', cb)
	client.start()
	time.sleep(500)
コード例 #3
0
def doPrint(baseFileName):

    pub.sendMessage('Log', arg1='debug', arg2='faye client started')

    #faye client *********************
    client = BayeuxClient('http://localhost:8000/faye')
    client.register('/messages', cb)

    client.start()
    #faye client end *****************

    fp = open(baseFileName, 'r')
    pub.sendMessage('Log', arg1='debug', arg2='gcode file opened')

    lines = fp.readlines()
    for line in lines:
        #pause
        while (state == 'pause'):
            pass
            #belki buraya siyeh ekran yaip dururum

        #cancel or stop
        if (state == 'stop'):
            print 'print canceled'
            return

        if ';<Slice>' in line:
            processSliceParam(line.split(' ')[1])
        if ';<Delay>' in line:
            processDelay(line.split(' ')[1])
        if not ';' in line:
            processGCode(line)

        for event in pygame.event.get():
            if event.type == pygame.QUIT:
                pygame.quit()

    pygame.quit()
コード例 #4
0
def doPrint():

    #faye client *********************
    client = BayeuxClient('http://localhost:8000/faye')
    client.register('/messages', cb)

    client.start()
    #faye client end *****************

    for line in range(0, 10):
        #pause
        while (state == 'pause'):
            print 'pause'
            pass
            #belki buraya siyeh ekran yaip dururum

        #cancel or stop
        if (state == 'stop'):
            print 'print canceled'
            return

        showSlide(line)
        processDelay(2)