Esempio n. 1
0
    def do_execute(self):
        """
        The actual execution of the actor.

        :return: None if successful, otherwise error message
        :rtype: str
        """
        result = None
        cont = self.input.payload
        name = str(self.resolve_option("value"))
        value = cont.get(name)
        switch = bool(self.resolve_option("switch"))
        if switch:
            if self.first_active is not None:
                self.first_active.input = self.input
                result = self._director.execute()
            if result is None:
                self._output.append(Token(value))
        else:
            if self.first_active is not None:
                self.first_active.input = Token(value)
                result = self._director.execute()
            if result is None:
                self._output.append(self.input)
        return result
Esempio n. 2
0
    def do_execute(self):
        """
        The actual execution of the actor.

        :return: None if successful, otherwise error message
        :rtype: str
        """
        generator = datagen.DataGenerator.make_copy(self.resolve_option("setup"))
        generator.dataset_format = generator.define_data_format()
        if bool(self.resolve_option("incremental")) and generator.single_mode_flag:
            for i in xrange(generator.num_examples_act):
                self._output.append(Token(generator.generate_example()))
        else:
            data = generator.generate_examples()
            self._output.append(Token(data))
        return None
Esempio n. 3
0
 def do_execute(self):
     """
     The actual execution of the actor.
     :return: None if successful, otherwise error message
     :rtype: str
     """
     self._output.append(Token(None))
     return None
Esempio n. 4
0
 def do_execute(self):
     """
     The actual execution of the actor.
     :return: None if successful, otherwise error message
     :rtype: str
     """
     for s in self.resolve_option("strings"):
         self._output.append(Token(s))
     return None
Esempio n. 5
0
 def do_execute(self):
     """
     The actual execution of the actor.
     :return: None if successful, otherwise error message
     :rtype: str
     """
     formatstr = str(self.resolve_option("format"))
     expanded = self.storagehandler.expand(formatstr)
     self._output.append(Token(expanded))
     return None
Esempio n. 6
0
 def do_execute(self):
     """
     The actual execution of the actor.
     :return: None if successful, otherwise error message
     :rtype: str
     """
     for i in xrange(int(self.resolve_option("min")),
                     int(self.resolve_option("max")) + 1,
                     int(self.resolve_option("step"))):
         self._output.append(Token(i))
     return None
Esempio n. 7
0
 def do_execute(self):
     """
     The actual execution of the actor.
     :return: None if successful, otherwise error message
     :rtype: str
     """
     if self.storagehandler is None:
         return "No storage handler available!"
     sname = str(self.resolve_option("storage_name"))
     if sname not in self.storagehandler.storage:
         return "No storage item called '" + sname + "' present!"
     self._output.append(Token(self.storagehandler.storage[sname]))
     return None
Esempio n. 8
0
 def do_execute(self):
     """
     The actual execution of the actor.
     :return: None if successful, otherwise error message
     :rtype: str
     """
     iquery = InstanceQuery()
     iquery.db_url = str(self.resolve_option("db_url"))
     iquery.user = str(self.resolve_option("user"))
     iquery.password = str(self.resolve_option("password"))
     props = str(self.resolve_option("custom_props"))
     if (len(props) > 0) and os.path.isfile(props):
         iquery.custom_properties = props
     iquery.query = str(self.resolve_option("query"))
     data = iquery.retrieve_instances()
     self._output.append(Token(data))
     return None
Esempio n. 9
0
 def do_execute(self):
     """
     The actual execution of the actor.
     :return: None if successful, otherwise error message
     :rtype: str
     """
     directory = str(self.resolve_option("dir"))
     if not os.path.exists(directory):
         return "Directory '" + directory + "' does not exist!"
     if not os.path.isdir(directory):
         return "Location '" + directory + "' is not a directory!"
     collected = []
     result = self._list(directory, collected)
     if result is None:
         for c in collected:
             self._output.append(Token(c))
     return result