Example #1
0
File: sim.py Project: michel4j/mxdc
    def mount(self, port, wait=False):
        enabled = self.wait(states={State.IDLE, State.PREPARING})
        if not enabled:
            logger.warning('{}: not ready {}. command ignored!'.format(
                self.name, self.status))
            self.set_state(message="Not ready, command ignored!")
            self.cancel()
            return False
        elif self.is_mounted(port):
            logger.info('{}: Sample {} already mounted.'.format(
                self.name, port))
            self.set_state(message="Sample already mounted!")
            return True
        else:
            if self.is_mounted():
                command = self._sim_mountnext_done
                self._sim_mount_start('Mounting next Sample')
            else:
                self._sim_mount_start('Mounting sample')
                command = self._sim_mount_done

            logger.info('{}: Mounting Sample: {}'.format(self.name, port))
            GLib.timeout_add(8000, command, port)
            if wait:
                time.sleep(9)
                return True
            else:

                return True
Example #2
0
    def dismount(self, wait=False):
        self.power_on()
        enabled = self.wait(states={State.IDLE, State.PREPARING}, timeout=240)

        if not enabled:
            logger.warning('{}: not ready. command ignored!'.format(self.name))
            self.set_state(message="Not ready, command ignored!")
            self.cancel()
            return False
        elif not self.is_mounted():
            logger.info('{}: No Sample mounted.'.format(self.name))
            self.set_state(message="No Sample mounted!")
            return True
        else:
            self.dis_mount_cmd.put(1)
            logger.info('{}: Dismounting sample.'.format(self.name, ))
            success = self.wait(states={State.BUSY}, timeout=5)
            if wait and success:
                success = self.wait(states={State.STANDBY, State.IDLE},
                                    timeout=240)
                if not success:
                    self.set_state(message="Dismount timed out!")
                return success
            else:
                return success
Example #3
0
    def mount(self, port, wait=True):
        self.power_on()
        enabled = self.wait_until(State.IDLE, State.PREPARING, timeout=240)
        if not enabled:
            logger.warning('{}: not ready. command ignored!'.format(self.name))
            self.set_state(message="Not ready, command ignored!")
            self.cancel()
            return False
        elif self.is_mounted(port):
            logger.info('{}: Sample {} already mounted.'.format(
                self.name, port))
            self.set_state(message="Sample already mounted!")
            return True
        elif not self.is_mountable(port):
            logger.info('{}: Sample {} cannot be mounted!'.format(
                self.name, port))
            self.set_state(message="Port cannot be mounted!")
            return False
        else:
            self.next_smpl.put(port)
            self.mount_cmd.put(1)

            logger.info('{}: Mounting Sample: {}'.format(self.name, port))
            if wait:
                success = self.wait(states={State.BUSY}, timeout=10)
                if success:
                    success = self.wait(states={State.STANDBY, State.IDLE},
                                        timeout=120)
                if not success:
                    self.set_state(message="Mounting failed!")
                return success
            else:
                return True
Example #4
0
File: sim.py Project: michel4j/mxdc
    def dismount(self, wait=False):
        enabled = self.wait(states={State.IDLE, State.PREPARING})
        if not enabled:
            logger.warning('{}: not ready. command ignored!'.format(self.name))
            self.set_state(message="Not ready, command ignored!")
            self.cancel()
            return False
        elif not self.is_mounted():
            logger.info('{}: No Sample mounted.'.format(self.name))
            self.set_state(message="No Sample mounted!")
            return True
        else:
            self._sim_mount_start('Dismounting')

            logger.info('{}: Dismounting sample.'.format(self.name, ))
            if wait:
                time.sleep(8)
                self._sim_dismount_done()
                return True
            else:
                GLib.timeout_add(8000, self._sim_dismount_done)
                return True
Example #5
0
    def mount(self, port, wait=True):
        self.power_on()
        enabled = self.wait(states={State.IDLE, State.PREPARING}, timeout=240)
        if not enabled:
            logger.warning('{}: not ready. command ignored!'.format(self.name))
            self.set_state(message="Not ready, command ignored!")
            self.cancel()
            return False
        elif self.is_mounted(port):
            logger.info('{}: Sample {} already mounted.'.format(
                self.name, port))
            self.set_state(message="Sample already mounted!")
            return True
        elif self.is_valid(port) and self.is_mountable(port):
            self.next_sample.put(port)
            logger.info('{}: Mounting Sample: {}'.format(self.name, port))
            if self.is_mounted():
                self.mount_cmd.put(
                    1)  # translates to getput, or getputplate within bobcats
                success = self.wait(states={State.BUSY}, timeout=5)
            else:
                self.mount_cmd.put(
                    1)  # translates to put, putplate  within bobcats
                success = self.wait(states={State.BUSY}, timeout=5)

            if wait and success:
                success = self.wait(states={State.STANDBY, State.IDLE},
                                    timeout=240)
                if not success:
                    self.set_state(message="Mounting timed out!")
                return success
            else:
                return success
        else:
            logger.warning('{}: Invalid Port. Command ignored!'.format(
                self.name))
            self.set_state(message="Invalid Port. Command ignored!")
Example #6
0
File: sam.py Project: michel4j/mxdc
    def dismount(self, wait=False):
        enabled = self.wait_until(State.IDLE,
                                  State.PREPARING,
                                  State.STANDBY,
                                  timeout=360)
        if enabled and self.get_state('status') == State.STANDBY:
            self.set_state(
                message=
                'STANDBY. Mount will be excuted after current operation.')
            self.wait_while(State.STANDBY, timeout=720)

        if not enabled:
            logger.warning('{}: not ready. command ignored!'.format(self.name))
            self.set_state(message="Not ready, command ignored!")
            self.cancel()
            return False
        elif not self.is_mounted():
            logger.info('{}: No Sample mounted.'.format(self.name))
            self.set_state(message="No Sample mounted!")
            return True
        else:
            logger.info('{}: Dismounting sample.'.format(self.name, ))
            self.dismount_cmd.put(1)

            if wait:
                success = self.wait_while(State.IDLE, timeout=60)
                success |= self.wait_until(State.STANDBY,
                                           State.IDLE,
                                           timeout=360)
                mounted = self.sample_fbk.get()
                success |= (mounted == '')
                if not success:
                    self.set_state(message="Dismounting failed!")
                return success
            else:
                return True
Example #7
0
File: sam.py Project: michel4j/mxdc
    def prefetch(self, port, wait=False):
        if self.prefetched_fbk.get():
            return False

        enabled = self.wait_until(State.IDLE,
                                  State.PREPARING,
                                  State.STANDBY,
                                  timeout=360)
        if enabled and self.get_state('status') == State.STANDBY:
            self.set_state(
                message=
                'STANDBY. Mount will be excuted after current operation.')
            self.wait_while(State.STANDBY, timeout=720)

        if not enabled:
            logger.warning('{}: not ready. command ignored!'.format(self.name))
            self.set_state(message="Not ready, command ignored!")
            self.cancel()
            return False
        elif self.is_mounted(port):
            logger.info(
                '{}: Sample {} already mounted. Will not prefetch it.'.format(
                    self.name, port))
            self.set_state(message="Sample already mounted!")
            return True
        elif not self.is_mountable(port):
            logger.info('{}: Sample {} cannot be prefetched!'.format(
                self.name, port))
            self.set_state(message="Port cannot be prefetched!")
            return False
        else:
            logger.info('{}: Prefetch Sample: {}'.format(self.name, port))
            self.port_param.put(port)
            self.prefetch_cmd.put(1)

            if wait:
                success = self.wait_while(State.IDLE, timeout=60)
                success |= self.wait_until(State.IDLE, timeout=240)
                prefetched_port = self.prefetched_fbk.get()
                success |= port == prefetched_port
                if not success:
                    self.set_state(message="Prefetch failed!")
                return success
            else:
                return True