percival-detector / percivalui

The Percival detector python user interface
0 stars 2 forks source link

Error message in the Odin-Cntrl terminal, nothing reported in the Web GUI #95

Closed ajgdls closed 5 years ago

ajgdls commented 6 years ago

sometimes (not often), an error message ("Cannot submit command whilst another is active") appears in the command window from where Odin had been launched from. NO Error message appears on the web GUI (in the "Control Message Response" in web GUI, the state reported keeps displaying the formerly correctly-executed "gray" message). The command is not executed, but there is no alert indicating this on the web-GUI. If the user is awake enough, he can notice that the command is not displayed in the "Control Message Response", but it would be better if an alert "red" message could appear on the "Control Message Response" in web GUI

here is an example of the Error message:

[D 180504 09:22:15 adapter:143] Request content type: application/json [D 180504 09:22:15 adapter:93] HTTPServerRequest(protocol='http', host='127.0.0.1:8888', method='PUT', uri='/api/0.1/percival/cmd_scan_setpoints', version='HTTP/1.1', remote_ip='127.0.0.1', headers={'Creation-Time': '2018-05-04 09:22:15.254147', 'Host': '127.0.0.1:8888', 'Accept-Encoding': 'gzip, deflate', 'Content-Length': '82', 'Accept': 'application/json', 'User-Agent': 'hl_scan_setpoints.py', 'Connection': 'keep-alive', 'User': 'prcvlusr', 'Content-Type': 'application/json'}) [D 180504 09:22:15 adapter:94] dwell=2000&setpoints=03_0_PixelVoltages_ON&setpoints=04_0_PixelVoltages_ON&steps=4 [D 180504 09:22:15 adapter:127] {'parameters': {'dwell': '2000', 'setpoints': "['03_0_PixelVoltages_ON', '04_0_PixelVoltages_ON']", 'steps': '4'}, 'error': '(\'Cannot submit command whilst another is active\',) => Traceback (most recent call last):\n File "build/bdist.linux-x86_64/egg/percival/detector/adapter.py", line 117, in put\n self._detector.queue_command(cmd)\n File "build/bdist.linux-x86_64/egg/percival/detector/detector.py", line 850, in queue_command\n raise PercivalDetectorError("Cannot submit command whilst another is active")\nPercivalDetectorError: Cannot submit command whilst another is active\n', 'command': 'cmd_scan_setpoints', 'time': '2018-05-04 09:22:15.254147', 'param_names': ['dwell', 'setpoints', 'steps'], 'response': 'Failed'}

alessandromarras commented 6 years ago

I realized that I submitted this comment signed in as Alan rather than as me (I did not realize that an auto-login had me logged-in as Alan rather than as me). I apologize. I have disabled it Alessandro

wnichols1 commented 5 years ago

the error comes from detector.py:

def queue_command(self, command):

Special command case is an abort of a scan

    if not self.check_for_abort_command(command):
        if self._command_lock.acquire(False):
            command.activate()
            self._active_command = command
            self._command_queue.put(command, block=False)
            self._command_lock.release()
        else:
            raise PercivalDetectorError("Cannot submit command whilst another is active")
wnichols1 commented 5 years ago

in percival.js we have the function that processes the command response: function process_cmd_response(response) { } and it does nothing! but that's ok as the script runs update_server_command_status regularly. This GETs api/0.1/percival/action detector.py: elif parameter == "action": if self._active_command: reply = {'response': self._active_command.state, 'error': self._active_command.message, 'command': self._active_command.command_name, 'param_names': self._active_command.param_names, 'parameters': self._active_command.parameters, 'time': self._active_command.command_time }

wnichols1 commented 5 years ago

I've got the javascript to do a message box when the server drops a command 'cos it's busy.