def on_message(self, headers, data):

        pprint(data)

        if (data['status'] == "COMPLETE"):
            print("Complete.")
            print_scan_file_status(tempfile)

        if (data['status'] == "FAILED"):
            print("Failed.")
            print_scan_file_status(tempfile)
    def on_message(self, headers, data):

        pprint(data)

        if data["status"] == "COMPLETE":
            print("Complete.")
            print_scan_file_status(tempfile)

        if data["status"] == "FAILED":
            print("Failed.")
            print_scan_file_status(tempfile)
    def on_message(self, headers, data):
        global latest_message
        latest_message = data
        
        pc = data['percentComplete']
        
        print("Percentage complete: " + str(pc) + "%")
#         pprint(data)
    
        if (data['status'] == "COMPLETE"):
            print(data['message'])
            print(data['position'])
            print_scan_file_status(tempfile)
        
        if (data['status'] == "TERMINATED"):
            print("Terminated.")
Beispiel #4
0
    def on_message(self, headers, data):
        global latest_message
        latest_message = data

        pc = data['percentComplete']

        print("Percentage complete: " + str(pc) + "%")
        #         pprint(data)

        if (data['status'] == "COMPLETE"):
            print(data['message'])
            print(data['position'])
            print_scan_file_status(tempfile)

        if (data['status'] == "TERMINATED"):
            print("Terminated.")
conn_dict = {
    'acquire-request-topic':
    "/topic/org.eclipse.scanning.request.acquire.topic",
    'acquire-response-topic':
    "/topic/org.eclipse.scanning.response.acquire.topic",
}

# Used to maintain reference to the same request.
unique_id = str(uuid.uuid4())
# Tempfile to use for scan. Can check file size to determine if used.
fd, tempfile = tempfile.mkstemp(".nxs", prefix="acquire_test")

os.close(fd)

print_scan_file_status(tempfile)


class StatusTopicHandler(object):
    def on_message(self, headers, data):

        pprint(data)

        if (data['status'] == "COMPLETE"):
            print("Complete.")
            print_scan_file_status(tempfile)

        if (data['status'] == "FAILED"):
            print("Failed.")
            print_scan_file_status(tempfile)
conn_dict = {'scanning-submission-queue': "/queue/org.eclipse.scanning.submission.queue",
             'scanning-status-queue': "/queue/org.eclipse.scanning.status.set",
             'scanning-status-topic': "/topic/org.eclipse.scanning.status.topic",
             'position-response-topic': "/topic/org.eclipse.scanning.request.position.topic",
             }

# Used to maintain reference to the same request.
unique_id = str(uuid.uuid4())
# Keeps the last received message on the scanning status topic.
latest_message = ""
# Tempfile to use for scan. Can check file size to determine if used.
fd, tempfile = tempfile.mkstemp(".nxs", prefix="scan_test_")

os.close(fd)

print_scan_file_status(tempfile)


class StatusQueueHandler(object):
    
    def on_message(self, headers, data):
        status = data['status']
        if (status == "SUBMITTED"):
            print("Received message on status queue.")


class StatusTopicHandler(object):
    
    def on_message(self, headers, data):
        global latest_message
        latest_message = data