Exemplo n.º 1
0
    def setUp(self):
        remote_dir = '/riseml/workspace/engine/exp/lls-new-data-v3-try1-wp500-adaptive-on-telis-chatbot/expr1-mwer/1pass_recog/chatbot_test_v3-lp0.10-beam16'

        local_dir = base.mkdir('/Users/lls/tmp/run_wer_test')

        remote.download(remote.ali_ssh, remote_dir + '.*', local_dir)

        name = base.path_file_name(remote_dir)
        self.nbest = local_dir + '/' + name + '.nbest'
        self.refer = local_dir + '/' + name + '.refer'
        self.best = local_dir + '/' + name + '.best'
        self.log = local_dir + '/' + name + '.local.log'

        base.GetBest(self.nbest, None, self.best)
Exemplo n.º 2
0
 def install_http(self, url):
     ''' install a widget directly from a http address '''
     dest_temp_dir = tempfile.mkdtemp()
     remote.download(url, dest_temp_dir)
     package_file = os.path.join(dest_temp_dir, os.path.basename(url))
     # FIXME a weak check on whether we're dealing with a control
     if "files/controls" in url: install_dir = Settings.get_setting('control_install_dir')
     else: install_dir = Settings.get_setting('display_install_dir')
     
     # FIXME another reliance to the naming scheme on gd.de
     widget_name = os.path.basename(url).rsplit('-')[0]
     final_destination = local.unpack(package_file, install_dir, widget_name)
     
     # self.local_path = final_destination
     self.notify_observers("INSTALLED", uri)
     self.__find_local_desklets()
     return True
Exemplo n.º 3
0
 def install_version(self, version_number):
     ''' Install the given version of the widget in question. '''
     
     log("installing widget %s version %s" % (self.name, version_number))
     if self._install_parent_dir is None:
         raise "Widget.py: Attempt of installing a widget class. Should be done via subclasses." 
     
     ver = self.get_version(version_number)
     file_url = os.path.join(self.__remote_domain, ver['file_url'])
     #print "installing version", version_number, " from", file_url
     
     dest_temp_dir = tempfile.mkdtemp()
     remote.download(file_url, dest_temp_dir)
     package_file = os.path.join(dest_temp_dir, os.path.basename(file_url))
     final_destination = local.unpack(package_file, self._install_parent_dir, self.name)
     
     self.local_path = final_destination
     self.notify_observers("INSTALLED")
     
     return True