Exemplo n.º 1
0
 def __init__(self, engine, mic):
     Task.__init__(self)
     self.engine = engine
     self.channel = None
     self.mic = mic
     self.playing = False
     self.volume = 1.0
Exemplo n.º 2
0
 def __init__(self, goal):
     Task.__init__(self)
     self.goal = goal
     self.path_request = None
     self.path = deque()
     self.stuck = False
     self.update = self.__request_path
Exemplo n.º 3
0
    def __init__(self, name, **kwds):
        Task.__init__(self)
        self._name = name
        self._input_list = []
        self._output_list = []
        self._message_list = []

        # Optional arguments.
        if 'version' in kwds:
            self.version = kwds['version']

        # Update default user number.
        if self.userno == -1:
            self.userno = AIPS.userno

        # See if there is a proxy that can hand us the details for
        # this task.
        params = None
        for proxy in AIPS.proxies:
            try:
                inst = getattr(proxy, self.__class__.__name__)
                params = inst.params(name, self.version)
            except Exception, exception:
                if AIPS.debuglog:
                    print >>AIPS.debuglog, exception
                continue
            break
Exemplo n.º 4
0
    def __init__(self):
        Task.__init__(self)
        self.mouse                = pygame.mouse
        self.mouseListeners       = []
        self.keyListeners         = []
        self.systemListeners      = []
        self.priorityKeyListeners = []
        self.controls             = Controls()
        self.disableKeyRepeat()

        # Initialize joysticks
        pygame.joystick.init()
        self.joystickAxes = {}
        self.joystickHats = {}

        self.joysticks = [pygame.joystick.Joystick(id) for id in range(pygame.joystick.get_count())]
        for j in self.joysticks:
            j.init()
            self.joystickAxes[j.get_id()] = [0] * j.get_numaxes() 
            self.joystickHats[j.get_id()] = [(0, 0)] * j.get_numhats() 
        Log.debug("%d joysticks found." % (len(self.joysticks)))

        # Enable music events
        Audio.Music.setEndEvent(MusicFinished)

        # Custom key names
        self.getSystemKeyName = pygame.key.name
        pygame.key.name       = self.getKeyName
Exemplo n.º 5
0
  def __init__(self):

    self.logClassInits = Config.get("game", "log_class_inits")
    if self.logClassInits == 1:
      Log.debug("Input class init (Input.py)...")
  
    Task.__init__(self)
    self.mouse                = pygame.mouse
    self.mouseListeners       = []
    self.keyListeners         = []
    self.systemListeners      = []
    self.priorityKeyListeners = []
    self.controls             = Controls()
    self.disableKeyRepeat()

    # Initialize joysticks
    pygame.joystick.init()
    self.joystickAxes = {}
    self.joystickHats = {}

    self.joysticks = [pygame.joystick.Joystick(id) for id in range(pygame.joystick.get_count())]
    for j in self.joysticks:
      j.init()
      self.joystickAxes[j.get_id()] = [0] * j.get_numaxes() 
      self.joystickHats[j.get_id()] = [(0, 0)] * j.get_numhats() 
    Log.debug("%d joysticks found." % (len(self.joysticks)))

    # Enable music events
    Audio.Music.setEndEvent(MusicFinished)

    # Custom key names
    self.getSystemKeyName = pygame.key.name
    pygame.key.name       = self.getKeyName
Exemplo n.º 6
0
 def __init__(self, engine, mic):
   Task.__init__(self)
   self.engine = engine
   self.channel = None
   self.mic = mic
   self.playing = False
   self.volume = 1.0
Exemplo n.º 7
0
 def __init__(self, engine, controlnum, samprate=44100):
   Task.__init__(self)
   self.engine = engine
   self.controlnum = controlnum
   devnum = self.engine.input.controls.micDevice[controlnum]
   if devnum == -1:
     devnum = None
     self.devname = pa.get_default_input_device_info()['name']
   else:
     self.devname = pa.get_device_info_by_index(devnum)['name']
   self.mic = pa.open(samprate, 1, pyaudio.paFloat32, input=True, input_device_index=devnum, start=False)
   if Config.get('game', 'use_new_pitch_analyzer') or not have_pypitch:
     self.analyzer = Analyzer(samprate)
   else:
     self.analyzer = pypitch.Analyzer(samprate)
   self.mic_started = False
   self.lastPeak    = 0
   self.detectTaps  = True
   self.tapStatus   = False
   self.tapThreshold = -self.engine.input.controls.micTapSensitivity[controlnum]
   self.passthroughQueue = []
   passthroughVolume = self.engine.input.controls.micPassthroughVolume[controlnum]
   if passthroughVolume > 0.0:
     Log.debug('Microphone: creating passthrough stream at %d%% volume' % round(passthroughVolume * 100))
     self.passthroughStream = Audio.MicrophonePassthroughStream(engine, self)
     self.passthroughStream.setVolume(passthroughVolume)
   else:
     Log.debug('Microphone: not creating passthrough stream')
     self.passthroughStream = None
 def __init__(self, server, command):
     Task.__init__(self)
     self.server= server
     self.command=command
     
     self.name="ExecuteRemoteWinCommandTask"
     self.description= "this task is used to execute command on remote machine through rpyc"
     self.stat=TaskStatus.RUNNING
Exemplo n.º 9
0
 def __init__(self, machinename, localfile, remotefile):
     Task.__init__(self)
     
     self.name="DownloadFileTask"
     self.description="This task is used to download file from rpyc server"
     self.stat=TaskStatus.RUNNING
     
     self.machinename=machinename
     self.localfile=localfile
     self.remotefile=remotefile
Exemplo n.º 10
0
 def __init__(self, tasks):
     Task.__init__(self, 0, "Bundle-", 0, 0, 0, [])
     self.tasks     = tasks  # The Tasks in the bundle.
     self.TasksMap  = {}     # Mappings of tasks to days.
     self.SkillsMap = {}     # Mappings of skill hours to days.
     self.contents  = []     # IDs of the tasks in the bundle.
     
     self.initialize(tasks)
     self.calculateDays(tasks)
     self.allocate()
     self.distribute(tasks)        
Exemplo n.º 11
0
    def __init__(self, name, **kwds):
        """  Create AIPS task object
        
        Creates task object and calls server function to parse the
        task help and POPSDAT.HLP files to obtain task specific
        parametrs and documentation.
        Following is a list of class members:
        _default_dict   = Dictionary with default values of parameters
        _input_list     = List of input parameters in order
        _output_list    = List of output parameters in order
        _min_dict       = Parameter minimum values as a List
        _max_dict       = Parameter maximum values as a List
        _hlp_dict       = Parameter descriptions (list of strings)
                          as a dictionary
        _strlen_dict    = String parameter lengths as dictionary
        _help_string    = Task Help documentation as list of strings
        _explain_string = Task Explain documentation as list of strings
        _short_help     = One line description of task
        _message_list   = list of execution messages
        Current parameter values are given as class members.
        """
        if not self._task_type:
            self._task_type = 'AIPS'
        Task.__init__(self)
        self._name = name
        self._input_list = []
        self._output_list = []
        self._message_list = []
        self._remainder = ""     # Partial message buffer
        # Optional arguments.
        if 'version' in kwds:
            self.version = kwds['version']
        else:
            if 'AIPS_VERSION' in os.environ:
                self.version = os.environ["AIPS_VERSION"]

        # Update default user number.
        if self.__class__.userno == 0:
            self.__class__.userno = AIPS.userno

        # See if there is a proxy that can hand us the details for
        # this task.
        params = None
        for proxy in AIPS.proxies:
            try:
                inst = getattr(proxy, self.__class__.__name__)
                params = inst.params(name, self.version)
            except Exception, exception:
                print exception
                if AIPS.debuglog:
                    print >>AIPS.debuglog, exception
                continue
            break
Exemplo n.º 12
0
 def __init__(self, engine, channel, fileName):
   Task.__init__(self)
   self.engine       = engine
   self.fileName     = fileName
   self.channel      = channel.channel
   self.playing      = False
   self.bufferSize   = 1024 * 64
   self.bufferCount  = 8
   self.volume       = 1.0
   self.buffer       = numpy.zeros((2 * self.bufferSize, 2), dtype = numpy.int16)
   self.decodingRate = 4
   self._reset()
Exemplo n.º 13
0
 def __init__(self, engine, channel, fileName):
     Task.__init__(self)
     self.engine = engine
     self.fileName = fileName
     self.channel = channel.channel
     self.playing = False
     self.bufferSize = 1024 * 64
     self.bufferCount = 8
     self.volume = 1.0
     self.buffer = Numeric.zeros((2 * self.bufferSize, 2), typecode="s")
     self.decodingRate = 4
     self._reset()
Exemplo n.º 14
0
 def __init__(self, engine, geometry=None):
     Task.__init__(self)
     self.layers = []
     self.incoming = []
     self.outgoing = []
     self.visibility = {}
     self.transitionTime = 512.0
     self.geometry = geometry or glGetIntegerv(GL_VIEWPORT)
     self.savedGeometry = None
     self.engine = engine
     w = self.geometry[2] - self.geometry[0]
     h = self.geometry[3] - self.geometry[1]
     self.aspectRatio = float(w) / float(h)
Exemplo n.º 15
0
 def __init__(self, engine, geometry = None):
     Task.__init__(self)
     self.layers = []
     self.incoming = []
     self.outgoing = []
     self.visibility = {}
     self.transitionTime = 512.0
     self.geometry = geometry or glGetIntegerv(GL_VIEWPORT)
     self.savedGeometry = None
     self.engine = engine
     w = self.geometry[2] - self.geometry[0]
     h = self.geometry[3] - self.geometry[1]
     self.aspectRatio = float(w) / float(h)
Exemplo n.º 16
0
 def __init__(self):
     Task.__init__(self)
     # Task settings
     self.allowMissing = False
     self.limitTrainingToAnnotated = True
     # Data files
     self.sequencesPath = "Swiss_Prot/Swissprot_sequence.tsv.gz"
     self.targetsPath = "CAFA3_targets/Target_files/target.all.fasta"
     self.annotationsPath = "data/Swissprot_propagated.tsv.gz"
     self.splitPath = "data"
     self.foldsPath = "folds/training_folds_170125.tsv.gz"
     self.termsPath = "GO/go_terms.tsv"
     # Feature settings
     self.features = {
         "taxonomy":
         TaxonomyFeatureBuilder(["Taxonomy"]),
         "similar":
         UniprotFeatureBuilder("Uniprot/similar.txt"),
         "blast":
         BlastFeatureBuilder(
             ["temp_blastp_result_features", "blastp_result_features"]),
         "blast62":
         BlastFeatureBuilder(
             ["CAFA2/training_features", "CAFA2/CAFA3_features"],
             tag="BLAST62"),
         "delta":
         BlastFeatureBuilder([
             "temp_deltablast_result_features", "deltablast_result_features"
         ],
                             tag="DELTA"),
         "interpro":
         InterProScanFeatureBuilder([
             "temp_interproscan_result_features",
             "interproscan_result_features"
         ]),
         "predgpi":
         PredGPIFeatureBuilder(["predGPI"]),
         "nucpred":
         NucPredFeatureBuilder(["nucPred"]),
         "netacet":
         NetAcetFeatureBuilder(["NetAcet"]),
         "funtaxis":
         FunTaxISFeatureBuilder(["FunTaxIS"]),
         "ngrams":
         NGramFeatureBuilder(
             ["ngrams/4jari/min_len3-min_freq2-min1fun-top_fun5k"])
     }
     self.defaultFeatures = [
         "taxonomy", "blast", "delta", "interpro", "predgpi"
     ]
Exemplo n.º 17
0
    def __init__(self, engine, channel, fileName):
      Task.__init__(self)
      self.engine       = engine
      self.fileName     = fileName
      self.channel      = channel
      self.playing      = False
      self.bufferSize   = 1024 * 64
      self.bufferCount  = 8
      self.volume       = 1.0

        #myfingershurt: buffer is 2D array (one D for each channel) of 16-bit UNSIGNED integers / samples
        #  2*1024*64 = 131072 samples per channel
      self.buffer       = zeros((2 * self.bufferSize, 2))

      self.decodingRate = 4
      self._reset()
Exemplo n.º 18
0
        def __init__(self, engine, channel, fileName):
            Task.__init__(self)
            self.engine = engine
            self.fileName = fileName
            self.channel = channel
            self.playing = False
            self.bufferSize = 1024 * 64
            self.bufferCount = 8
            self.volume = 1.0

            #myfingershurt: buffer is 2D array (one D for each channel) of 16-bit UNSIGNED integers / samples
            #  2*1024*64 = 131072 samples per channel
            self.buffer = zeros((2 * self.bufferSize, 2))

            self.decodingRate = 4
            self._reset()
Exemplo n.º 19
0
 def __init__(self):
     Task.__init__(self)
     # Task settings
     self.remapSets = {"test": "devel"}
     self.allowMissing = True
     self.limitTrainingToAnnotated = False
     # Data files
     self.sequencesPath = "CAFA_PI/Swissprot/CAFA_PI_Swissprot_sequence.tsv.gz"
     self.targetsPath = "CAFA_PI/Swissprot/target.all.fasta.gz"
     self.annotationsPath = "CAFA_PI/Swissprot/CAFA_PI_Swissprot_propagated.tsv.gz"
     self.splitPath = "CAFA_PI/Swissprot"
     self.foldsPath = "folds/CAFA_PI_training_folds_180417.tsv.gz"
     self.termsPath = "GO/go_terms.tsv"
     # Feature settings
     self.features = {
         "taxonomy":
         TaxonomyFeatureBuilder(["CAFA_PI/features/Taxonomy"]),
         "blast":
         BlastFeatureBuilder([
             "CAFA_PI/features/temp_blastp_result_features",
             "CAFA_PI/features/blastp_result_features"
         ]),
         "blast62":
         BlastFeatureBuilder([
             "CAFA_PI/features/CAFA2/training_features",
             "CAFA_PI/features/CAFA2/CAFA3_features"
         ],
                             tag="BLAST62"),
         "delta":
         BlastFeatureBuilder([
             "CAFA_PI/features/temp_deltablast_result_features",
             "CAFA_PI/features/deltablast_result_features"
         ],
                             tag="DELTA"),
         "interpro":
         InterProScanFeatureBuilder([
             "CAFA_PI/features/temp_interproscan_result_features",
             "CAFA_PI/features/interproscan_result_features"
         ]),
         "predgpi":
         PredGPIFeatureBuilder(["CAFA_PI/features/predGPI"]),
         "nucpred":
         NucPredFeatureBuilder(["CAFA_PI/features/nucPred"]),
         "netacet":
         NetAcetFeatureBuilder(["CAFA_PI/features/NetAcet"])
     }
     self.defaultFeatures = ["all"]
Exemplo n.º 20
0
    def __init__(self, fileName,engine,speed = 1):
      Task.__init__(self)
      if not engine:
        engine = GameEngine.getEngine()
      self.engine       = engine
      self.fileName     = fileName
      self.channel      = None
      self.playing      = False
      self.bufferSize   = 1024 * 64
      self.bufferCount  = 8
      self.volume       = 1.0
      self.event = None
      self.speed = speed

        #myfingershurt: buffer is 2D array (one D for each channel) of 16-bit UNSIGNED integers / samples
        #  2*1024*64 = 131072 samples per channel
      self.buffer       = np.zeros((2 * self.bufferSize, 2),dtype=np.int16)

      self.decodingRate = 4
      self._reset()
Exemplo n.º 21
0
 def __init__(self, engine, geometry = None, screens = 1):
   Task.__init__(self)
   self.layers = []
   self.incoming = []
   self.outgoing = []
   self.visibility = {}
   self.transitionTime = 512.0
   self.engine = engine
   if geometry:
     self.geometry = list(geometry)
   else:
     self.geometry = list(glGetIntegerv(GL_VIEWPORT))
   w = self.geometry[2] - self.geometry[0]
   h = self.geometry[3] - self.geometry[1]
   self.aspectRatio = float(w) / float(h)
   self.geometryNormalized = [0,0,0,0]
   self.setNormalizedGeometry()
   self.geometryAll = None
   self.initGeometryAll()
   self.geometryAllHalf = None
   self.initGeometryAllHalf()
Exemplo n.º 22
0
 def __init__(self, engine, geometry = None, screens = 1):
     Task.__init__(self)
     self.layers = []
     self.incoming = []
     self.outgoing = []
     self.visibility = {}
     self.transitionTime = 512.0
     self.engine = engine
     if geometry:
         self.geometry = list(geometry)
     else:
         self.geometry = list(glGetIntegerv(GL_VIEWPORT))
     w = self.geometry[2] - self.geometry[0]
     h = self.geometry[3] - self.geometry[1]
     self.aspectRatio = float(w) / float(h)
     self.geometryNormalized = [0,0,0,0]
     self.setNormalizedGeometry()
     self.geometryAll = None
     self.initGeometryAll()
     self.geometryAllHalf = None
     self.initGeometryAllHalf()
Exemplo n.º 23
0
 def __init__(self, engine, controlnum, samprate=44100):
     Task.__init__(self)
     self.engine = engine
     self.controlnum = controlnum
     devnum = self.engine.input.controls.micDevice[controlnum]
     if devnum == -1:
         devnum = None
         self.devname = pa.get_default_input_device_info()['name']
     else:
         self.devname = pa.get_device_info_by_index(devnum)['name']
     self.mic = pa.open(samprate,
                        1,
                        pyaudio.paFloat32,
                        input=True,
                        input_device_index=devnum,
                        start=False)
     if Config.get('game',
                   'use_new_pitch_analyzer') or not have_pypitch:
         self.analyzer = Analyzer(samprate)
     else:
         self.analyzer = pypitch.Analyzer(samprate)
     self.mic_started = False
     self.lastPeak = 0
     self.detectTaps = True
     self.tapStatus = False
     self.tapThreshold = -self.engine.input.controls.micTapSensitivity[
         controlnum]
     self.passthroughQueue = []
     passthroughVolume = self.engine.input.controls.micPassthroughVolume[
         controlnum]
     if passthroughVolume > 0.0:
         Log.debug(
             'Microphone: creating passthrough stream at %d%% volume' %
             round(passthroughVolume * 100))
         self.passthroughStream = Audio.MicrophonePassthroughStream(
             engine, self)
         self.passthroughStream.setVolume(passthroughVolume)
     else:
         Log.debug('Microphone: not creating passthrough stream')
         self.passthroughStream = None
Exemplo n.º 24
0
 def __init__(self):
     Task.__init__(self)
Exemplo n.º 25
0
 def __init__(self, channels=8):
     Task.__init__(self)
     self.eventLoop = pyglet.app.EventLoop()
     self.channels = [Channel(i) for i in range(channels)]
Exemplo n.º 26
0
 def __init__(self):
     Task.__init__(self)
     self.name="CreateLinuxDSNTask"
     self.description="this task is used to Configue the DSN on Linux machine."
     self.stat = self.RUNNING
     self.info = "create DSN task is running"
Exemplo n.º 27
0
 def __init__(self):
     Task.__init__(self)
     self.name="SimulaterLinuxServer"
     self.description="this task is used to Simulate Linux server"
     self.stat = self.RUNNING
     self.info = "start Simulate server"
Exemplo n.º 28
0
    def __init__(self, env, id,
                 frame_h= SimParams.FRAME_DEFAULT_H, \
                 frame_w = SimParams.FRAME_DEFAULT_W, \
                 frame_rate = SimParams.FRAME_RATE, \
                 frame_type = "I", \
                 frame_ix_in_gop = 0, \
                 unique_gop_id = 0, \
                 gop_id = 0, \
                 gop_struct = SimParams.GOP_STRUCTURE, \
                 video_stream_id = None, \
                 wf_id = None, \
                 priority = None,

                 ## optional params ##
                 calc_deps = True,
                 calc_cc = True,
                 calc_pri = True
                 ):

        ## pass params to parent class
        Task.__init__(self, env, "MPGFrame-" + frame_type, id, None, None,
                      None, None, None, priority, env.now)

        ## gop-level
        self.parent_gop_id = gop_id  # same sequence of gops in two videos may have same same GOP number
        self.unique_gop_id = unique_gop_id

        ##  frame level
        self.frame_h = frame_h
        self.frame_w = frame_w
        self.frame_rate = frame_rate
        self.frame_type = frame_type
        self.frame_num_pixels = (self.frame_h * self.frame_w)
        self.frame_ix_in_gop = frame_ix_in_gop
        if (calc_pri == True):
            self.frame_priority = self.calc_FramePriorityInsideGOP(
                self.frame_ix_in_gop)  # according to isovic and fohler

        #self.priority = priority
        ## gop-level
        self.gop_structure = gop_struct
        self.period = float(
            float(len(self.gop_structure)) *
            float(1.0 / float(self.frame_rate)))

        ## video-level
        self.video_stream_id = video_stream_id
        self.wf_id = wf_id
        self.video_genre = None
        self.IsHeadVideoGop = False  # is this frame in the first video stream GOP
        self.IsTailVideoGop = False  # is this frame in the last video stream GOP

        # platform level
        self.dispatched_ibuffid = None

        if (calc_deps == True):
            # which other frames/tasks do I need to complete this task ?
            self.frame_dependencies = self.calc_FrameDependencies(
                self.frame_ix_in_gop, self.id)['dep_gop_frames_ixs']
            self.set_dependencies(
                self.calc_FrameDependencies(
                    self.frame_ix_in_gop,
                    self.id)['dep_task_ids'])  # dependent tasks

            # which other frame/task needs this task once it's completed ?
            # when task is finished these dep-pointers will be used to send the
            # completed task to the other cores
            # Note : these only track task_ids
            self.which_frames_needs_me = self.calc_FrameDependencies(
                self.frame_ix_in_gop,
                self.id)['which_frame_needs_current_frame']
            self.which_tasks_needs_me = self.calc_FrameDependencies(
                self.frame_ix_in_gop, self.id)['which_task_needs_current_task']
            self.my_closest_children = self.calc_FrameDependencies(
                self.frame_ix_in_gop, self.id)['my_closest_children']
            self.my_closest_parent = self.calc_FrameDependencies(
                self.frame_ix_in_gop, self.id)['my_closest_parent']
            self.non_dep_frames = self.calc_FrameDependencies(
                self.frame_ix_in_gop, self.id)['non_dep_frames']
            self.possible_interfering_frame = self.calc_FrameDependencies(
                self.frame_ix_in_gop, self.id)['possible_interfering_frames']

        if (calc_cc == True):
            ##  block level specs
            self.block_h = 8
            self.block_w = 8
            #self.B_max = int(round((self.frame_h * self.frame_w) / (self.block_h * self.block_w)))  # max blocks per frame
            self.B_max = int(
                round(
                    float(self.frame_h * self.frame_w) / float(
                        self.block_h * self.block_w)))  # max blocks per frame
            self.B_min = 0  # at least 1 block per frame ?

            ## block level timing specs (in ms)
            # refer to :
            # [1]Y. Tan, P. Malani, Q. Qiu, and QingWu,
            #     'Workload prediction and dynamic voltage scaling for MPEG decoding,'
            #     in Asia and South Pacific Conference on Design Automation, 2006,
            # [2]P. Malani, Y. Tan, and Q. Qiu,
            # 'Resource-aware High Performance Scheduling for Embedded MPSoCs With the Application of MPEG Decoding,'
            # in 2007 IEEE International Conference on Multimedia and Expo, 2007

            self.M1_t = float(
                SimParams.MPEG_BLOCK_M1_T *
                SimParams.CPU_EXEC_SPEED_RATIO)  # used in : I, P, B
            self.M2_t = float(SimParams.MPEG_BLOCK_M2_T *
                              SimParams.CPU_EXEC_SPEED_RATIO)  # used in : P
            self.M3_t = float(SimParams.MPEG_BLOCK_M3_T *
                              SimParams.CPU_EXEC_SPEED_RATIO)  # used in : P
            self.M4_t = float(SimParams.MPEG_BLOCK_M4_T *
                              SimParams.CPU_EXEC_SPEED_RATIO)  # used in : B
            self.M5_t = float(SimParams.MPEG_BLOCK_M5_T *
                              SimParams.CPU_EXEC_SPEED_RATIO)  # used in : B
            self.M6_t = float(SimParams.MPEG_BLOCK_M6_T *
                              SimParams.CPU_EXEC_SPEED_RATIO)  # used in : B
            self.M7_t = float(SimParams.MPEG_BLOCK_M7_T *
                              SimParams.CPU_EXEC_SPEED_RATIO)  # used in : B
            self.M8_t = float(SimParams.MPEG_BLOCK_M8_T *
                              SimParams.CPU_EXEC_SPEED_RATIO)  # used in : P, B
            self.M9_t = float(
                SimParams.MPEG_BLOCK_M9_T * SimParams.CPU_EXEC_SPEED_RATIO
            )  # Run-length coding time : propotional to frame size
            self.M10_t = float(
                SimParams.MPEG_BLOCK_M10_T * SimParams.CPU_EXEC_SPEED_RATIO
            )  # constant : used when generating the linear regression model

            ## task level rts specs - need to calculate
            cc = self.calc_FrameComputationTime(self.frame_type)
            self.set_computationCost(cc)
            self.set_remainingComputationCost(cc)

            ## deadline calculation
            dl = (1.0 / self.frame_rate)
            self.set_deadline(dl)  # this will be adjusted later

            self.end_to_end_deadline = (float(len(self.gop_structure)) /
                                        float(self.frame_rate))

            max_mem = (
                (self.frame_h * self.frame_w) * 16
            ) / 8  # 16 bit, rgb, assume I_size = P_size = B_size  (in bytes)                                                                  )
            self.set_maxMemConsumption(max_mem)
            self.set_timeLeftTillCompletion(cc)
            self.set_timeLeftTillDeadline(dl)

            self.absDeadline = None
            self.completedTaskSize = max_mem

        # worst case execution times of different types of frames - stored for later use
        self.wccIFrame = None
        self.wccPFrame = None
        self.wccBFrame = None

        # avg case execution times of different types of frames - stored for later use
        self.avgccIFrame = None
        self.avgccPFrame = None
        self.avgccBFrame = None

        # time which all deps of the tasks were complete and available
        self.deps_allcomplete_time = None

        # relative subtask deadline
        self.relative_deadline = None

        # analytical wcet/wcrt
        self.analytical_wcet = None
        self.analytical_wcrt_with_deps = None

        # task size
        self.mpeg_tasksize = self.calc_encoded_mpegframe_size()
Exemplo n.º 29
0
    def __init__(self, name, **kwds):
        Task.__init__(self)
        self._name = name
        self._input_list = []
        self._output_list = []
        self._message_list = []

        # Optional arguments.
        if 'version' in kwds:
            self.version = kwds['version']

        # Update default user number.
        if self.userno == -1:
            self.userno = AIPS.userno

        # See if there is a proxy that can hand us the details for
        # this task.
        params = None
        for proxy in AIPS.proxies:
            try:
                inst = getattr(proxy, self.__class__.__name__)
                params = inst.params(name, self.version)
            except Exception as exception:
                if AIPS.debuglog:
                    print(exception, file=AIPS.debuglog)
                continue
            break
        if not params:
            msg = "%s task '%s' is not available" % (self._package, name)
            raise RuntimeError(msg)

        # The XML-RPC proxy will return the details as a dictionary,
        # not a class.
        self._default_dict = params['default_dict']
        self._input_list = params['input_list']
        self._output_list = params['output_list']
        self._min_dict = params['min_dict']
        self._max_dict = params['max_dict']
        self._strlen_dict = params['strlen_dict']
        self._help_string = params['help_string']
        self._explain_string = params['explain_string']
        for adverb in self._default_dict:
            if type(self._default_dict[adverb]) == list:
                value = self._default_dict[adverb]
                self._default_dict[adverb] = List(self, adverb, value)

        # Initialize all adverbs to their default values.
        self.defaults()

        # The maximum value for disk numbers is system-dependent.
        for name in self._disk_adverbs:
            if name in self._max_dict:
                self._max_dict[name] = float(len(AIPS.disks) - 1)
                pass
            continue

        # The maximum channel is system-dependent.
        for name in self._chan_adverbs:
            if name in self._max_dict:
                # Assume the default
                self._max_dict[name] = 16384.0
                pass
            continue

        # The maximum image size is system-dependent.
        for name in self._box_adverbs:
            if name in self._max_dict:
                # Assume the default
                self._max_dict[name] = 32768.0
                pass
            continue

        return  # __init__
Exemplo n.º 30
0
 def __init__(self):
   Task.__init__(self)
Exemplo n.º 31
0
    def __init__(self, name, **kwds):
        """  Create ObitScript task object
        
        Creates Script Object.
        name  = name of script object
        Optional Keywords:
            script   = Script to execute as string or list of strings
            file     = Name of text file containing script
            URL      = URL on which the script is to be executed
                       Default = None = local execution
            AIPSDirs = List of AIPS directories on URL
                       Default = current AIPS directories on url
            FITSDirs = List of FITS directories on URL
                       Default = current FITS directories on url
            AIPSUser = AIPS user number for AIPS data files
                       Default is current
            version  = AIPS version string, Default = current
        Following is a list of class members:
            url      = URL of execution server, None=Local
            proxy    = Proxy for URL
            script   = Script as text string
            userno   = AIPS user number
            AIPSDirs = List of AIPS directories on URL
            FITSDirs = List of FITS directories on URL
            AIPSUser = AIPS user number for AIPS data files
            version  = AIPS version string
            _message_list = messages from Script execution
        """
        Task.__init__(self)

        self._name = name
        self.url = None  # URL - local
        self.proxy = LocalProxy  # proxy
        self._message_list = []
        self.AIPSDirs = []
        self.FITSDirs = []
        self.script = []
        self._remainder = ""  # Partial message buffer

        # Optional arguments.
        if 'URL' in kwds:
            self.url = kwds['URL']
            self.proxy = ServerProxy(self.url)
        elif 'url' in kwds:
            self.url = kwds['url']
            self.proxy = ServerProxy(self.url)
        else:
            self.url = None
            self.proxy = LocalProxy

        # AIPS directories on target host
        self.AIPSDirs = []
        if 'AIPSDirs' in kwds:
            for x in kwds['AIPSDirs']:
                self.AIPSDirs.append(x)
        else:  # Current disks on self.url
            for x in AIPS.disks:
                if x != None and x.url == self.url:
                    self.AIPSDirs.append(x.dirname)

        # FITS directories on target host
        self.FITSDirs = []
        if 'FITSDirs' in kwds:
            for x in kwds['FITSDirs']:
                self.FITSDirs.append(x)
        else:  # Current disks on self.url
            for x in FITS.disks:
                if x != None and x.url == self.url:
                    self.FITSDirs.append(x.dirname)

        if 'AIPSUser' in kwds:
            self.userno = kwds['AIPSUser']
        else:
            self.userno = AIPS.userno

        # Script given
        if 'script' in kwds:
            scr = kwds['script']
            if type(scr) == list:  # List of strings
                self.script = scr
            else:  # Simple string
                self.script.append(scr)

        # File name given
        if 'file' in kwds:
            input = open(kwds['file'])
            line = " "
            while (line):
                line = input.readline()  # read next line
                if not line:  # EOF?
                    break
                self.script.append(line)
            input.close()

        # Update default user number.
        if self.__class__.userno == 0:
            self.__class__.userno = AIPS.userno

        return  # __init__
Exemplo n.º 32
0
 def __init__(self, id, name, desc, date, duration, startTask, finalTasks, pred, succ, children, resources, deliverables):
 	Task.__init__(self, id, name, desc, date, duration, pred, succ, resources, deliverables)
 	self.children = children
     self.startTask = startTask
     self.finalTasks = finalTasks
Exemplo n.º 33
0
 def __init__(self):
     Task.__init__(self)
     self.name="MonitorLinuxServer"
     self.description="this task is used to monitor Linux server"
     self.stat = self.RUNNING
     self.info = "start monitor server task is running"
Exemplo n.º 34
0
 def __init__(self):
     Task.__init__(self)
     self.name = "ConfigLinuxDiagTask"
     self.description = "this task is used to configure the performance counter and log size"
     self.stat = self.RUNNING
     self.info = "configure the diag task is running"
Exemplo n.º 35
0
    def __init__(self, env, id, frame_h= 1152, frame_w = 1440, frame_rate = 25, gop_size = SimParams.GOP_LENGTH , \
                 gop_struct = SimParams.GOP_STRUCTURE,
                 priority = 1,
                 seed = time.time()):

        ## pass params to parent class
        Task.__init__(self, env, "MPEG2GOPTask", id, None, None, None, None,
                      None, priority)

        ##  frame level
        self.frame_h = frame_h
        self.frame_w = frame_w
        self.frame_rate = frame_rate

        ##  gop specific
        self.gop_length = gop_size
        self.gop_struct = gop_struct
        self.gop_size_bytes = self.gop_length * (self.frame_h * self.frame_w)

        ##  block level specs
        self.block_h = 8
        self.block_w = 8
        self.B_max = int(
            round((self.frame_h * self.frame_w) /
                  (self.block_h * self.block_w)))  # max blocks per frame
        self.B_min = 1  # at least 1 block per frame

        ## block level timing specs (in ms)
        # refer to :
        # [1]Y. Tan, P. Malani, Q. Qiu, and QingWu,
        #     'Workload prediction and dynamic voltage scaling for MPEG decoding,'
        #     in Asia and South Pacific Conference on Design Automation, 2006,
        # [2]P. Malani, Y. Tan, and Q. Qiu,
        # 'Resource-aware High Performance Scheduling for Embedded MPSoCs With the Application of MPEG Decoding,'
        # in 2007 IEEE International Conference on Multimedia and Expo, 2007

        self.M1_t = 0.000050
        self.M2_t = 0.000002
        self.M3_t = 0.000001
        self.M4_t = 0.000005
        self.M5_t = 0.000009
        self.M6_t = 0.000006
        self.M7_t = 0.000003
        self.M8_t = 0.000001
        self.M9_t = 0.000015  # Run-length coding time : propotional to frame size

        ## task level rts specs - need to calculate
        cc = self.calc_GOPComputationTime()
        self.set_computationCost(cc)
        dl = float(self.gop_length) * (1.0 / self.frame_rate)
        #print float(self.gop_length) * (1.0/self.frame_rate)
        self.set_deadline(dl)

        max_mem = (
            ((self.frame_h * self.frame_w) * self.gop_length) * (16) / 8
        )  # 16 bit, rgb, assume I_size = P_size = B_size  # in bytes                                                                     )
        self.set_maxMemConsumption(max_mem)

        self.set_timeLeftTillCompletion(cc)
        self.set_timeLeftTillDeadline(dl)

        ## randomiser specific
        self._gop_rand_seed = seed + self.id
Exemplo n.º 36
0
 def __init__(self):
     Task.__init__(self)
     self.name="installtomcatwebonLinux"
     self.description="this task is used to install tomcat web on Linux"
     self.stat = self.RUNNING
     self.info = "this task is used to install tomcat web on Linux"
Exemplo n.º 37
0
 def __init__(self):
     Task.__init__(self)
     self.name="ConfigUnixIServerTask"
     self.description="this task is used to configure iServer on Unix machine"
     self.info="configure Linux iserver is started"
Exemplo n.º 38
0
 def __init__(self):
     Task.__init__(self)
     self.name="installLinuxBuildTask"
     self.description="this task is used to install Linux build"
     self.stat = self.RUNNING
     self.info = "install Linux build task is running"
Exemplo n.º 39
0
 def __init__(self):
     Task.__init__(self)
     self.name="ClearSystemCacheTask"
     self.description="this task is used to clear system caches"
     self.stat = self.RUNNING
     self.info = "clear system cache task is running"
Exemplo n.º 40
0
 def __init__(self, channels = 8):
   Task.__init__(self)
   self.eventLoop = pyglet.app.EventLoop()
   self.channels = [Channel(i) for i in range(channels)]
Exemplo n.º 41
0
    def __init__(self, name, **kwds):
        """  Create AIPS task object
        
        Creates task object and calls server function to parse the
        task help and POPSDAT.HLP files to obtain task specific
        parametrs and documentation.
        Following is a list of class members:
        _default_dict   = Dictionary with default values of parameters
        _input_list     = List of input parameters in order
        _output_list    = List of output parameters in order
        _min_dict       = Parameter minimum values as a List
        _max_dict       = Parameter maximum values as a List
        _hlp_dict       = Parameter descriptions (list of strings)
                          as a dictionary
        _strlen_dict    = String parameter lengths as dictionary
        _help_string    = Task Help documentation as list of strings
        _explain_string = Task Explain documentation as list of strings
        _short_help     = One line description of task
        _message_list   = list of execution messages
        Current parameter values are given as class members.
        """
        if not self._task_type:
            self._task_type = 'AIPS'
        Task.__init__(self)
        self._name = name
        self._input_list = []
        self._output_list = []
        self._message_list = []
        self._remainder = ""  # Partial message buffer
        # Optional arguments.
        if 'version' in kwds:
            self.version = kwds['version']
        else:
            if 'AIPS_VERSION' in os.environ:
                self.version = os.environ["AIPS_VERSION"]

        # Update default user number.
        if self.__class__.userno == 0:
            self.__class__.userno = AIPS.userno

        # See if there is a proxy that can hand us the details for
        # this task.
        params = None
        for proxy in AIPS.proxies:
            try:
                inst = getattr(proxy, self.__class__.__name__)
                params = inst.params(name, self.version)
            except Exception as exception:
                print(exception)
                if AIPS.debuglog:
                    print(exception, file=AIPS.debuglog)
                continue
            break
        if not params:
            msg = "%s task '%s' is not available" % (self._package, name)
            raise RuntimeError(msg)

        # The XML-RPC proxy will return the details as a dictionary,
        # not a class.
        self._default_dict = params['default_dict']
        self._input_list = params['input_list']
        self._output_list = params['output_list']
        self._min_dict = params['min_dict']
        self._max_dict = params['max_dict']
        self._hlp_dict = params['hlp_dict']
        self._strlen_dict = params['strlen_dict']
        self._help_string = params['help_string']
        self._explain_string = params['explain_string']
        self._short_help = params['short_help']
        if self._task_type == 'OBIT':
            self._type_dict = params['type_dict']
            self._dim_dict = params['dim_dict']
        for adverb in self._default_dict:
            if type(self._default_dict[adverb]) == list:
                value = self._default_dict[adverb]
                self._default_dict[adverb] = List(self, adverb, value)

        # Initialize all adverbs to their default values.
        self.__dict__.update(self._default_dict)

        # The maximum value for disk numbers is bogus.
        for name in self._disk_adverbs:
            if name in self._max_dict:
                self._max_dict[name] = float(len(AIPS.disks) - 1)

        return  # __init__
Exemplo n.º 42
0
  def __init__(self):

    self.logClassInits = Config.get("game", "log_class_inits")
    if self.logClassInits == 1:
      Log.debug("Input class init (Input.py)...")
  
    Task.__init__(self)
    self.mouse                = pygame.mouse
    self.mouseListeners       = []
    self.keyListeners         = []
    self.systemListeners      = []
    self.priorityKeyListeners = []
    self.controls             = Player.Controls()
    self.activeGameControls   = []
    self.p2Nav                = self.controls.p2Nav
    self.type1                = self.controls.type[0]
    self.keyCheckerMode       = Config.get("game","key_checker_mode")
    self.disableKeyRepeat()
    
    self.gameGuitars = 0
    self.gameDrums   = 0
    self.gameMics    = 0
    self.gameBots    = 0

    # Initialize joysticks
    pygame.joystick.init()
    self.joystickNames = {}
    self.joystickAxes  = {}
    self.joystickHats  = {}
    self.joyOff = False

    self.joysticks = [pygame.joystick.Joystick(id) for id in range(pygame.joystick.get_count())]
    for j in self.joysticks:
      j.init()
      self.joystickNames[j.get_id()] = j.get_name()
      self.joystickAxes[j.get_id()]  = [0] * j.get_numaxes() 
      self.joystickHats[j.get_id()]  = [(0, 0)] * j.get_numhats() 
    joyNum = len(self.joysticks)
    Log.debug("%d joysticks found." % (joyNum))
    oldJoyNum = Config.get("game", "joysticks")
    if joyNum != oldJoyNum:
      self.joyOff = True
    Config.set("game", "joysticks", joyNum)

    # Enable music events
    Audio.Music.setEndEvent(MusicFinished)
    #Audio.Music.setEndEvent()   #MFH - no event required?

    # Custom key names
    self.getSystemKeyName = pygame.key.name
    pygame.key.name       = self.getKeyName

    if haveMidi:
      if ports:
        Log.debug("%d MIDI inputs found." % (len(ports)))
        try:
          for i in ports:
            midi[i].openPort(i, False)
        except Exception, e:
          Log.error("Error opening MIDI port %d: %s" % (i,str(e)) )
      else:
        Log.warn("No MIDI input ports found.")
Exemplo n.º 43
0
 def __init__(self, engine, channel, fileName):
   Task.__init__(self)
   Sound.__init__(self, fileName)
   self.channel = channel
Exemplo n.º 44
0
    def __init__(self):

        self.logClassInits = Config.get("game", "log_class_inits")
        if self.logClassInits == 1:
            Log.debug("Input class init (Input.py)...")

        Task.__init__(self)
        self.mouse                = pygame.mouse
        self.mouseListeners       = []
        self.keyListeners         = []
        self.systemListeners      = []
        self.priorityKeyListeners = []
        self.controls             = Controls()
        self.activeGameControls   = []
        self.p2Nav                = self.controls.p2Nav
        self.type1                = self.controls.type[0]
        self.keyCheckerMode       = Config.get("game","key_checker_mode")
        self.disableKeyRepeat()

        self.gameGuitars = 0
        self.gameDrums   = 0
        self.gameMics    = 0
        self.gameBots    = 0

        # Initialize joysticks
        pygame.joystick.init()
        self.joystickNames = {}
        self.joystickAxes  = {}
        self.joystickHats  = {}

        self.joysticks = [pygame.joystick.Joystick(id) for id in range(pygame.joystick.get_count())]
        for j in self.joysticks:
            j.init()
            self.joystickNames[j.get_id()] = j.get_name()
            self.joystickAxes[j.get_id()]  = [0] * j.get_numaxes()
            self.joystickHats[j.get_id()]  = [(0, 0)] * j.get_numhats()
        Log.debug("%d joysticks found." % len(self.joysticks))

        # Enable music events
        Audio.Music.setEndEvent(MusicFinished)
        #Audio.Music.setEndEvent()   #MFH - no event required?

        # Custom key names
        self.getSystemKeyName = pygame.key.name
        pygame.key.name       = self.getKeyName

        self.midi = []
        if haveMidi:
            pygame.midi.init()
            for i in range(pygame.midi.get_count()):
                interface, name, is_input, is_output, is_opened = pygame.midi.get_device_info(i)
                Log.debug("Found MIDI device: %s on %s" % (name, interface))
                if not is_input:
                    Log.debug("MIDI device is not an input device.")
                    continue
                try:
                    self.midi.append(pygame.midi.Input(i))
                    Log.debug("Device opened as device number %d." % len(self.midi))
                except pygame.midi.MidiException:
                    Log.error("Error opening device for input.")
            if len(self.midi) == 0:
                Log.debug("No MIDI input ports found.")
        else:
            Log.notice("MIDI input support is not available; install at least pygame 1.9 to get it.")
Exemplo n.º 45
0
 def __init__(self, engine, channel, fileName):
     Task.__init__(self)
     Sound.__init__(self, fileName)
     self.channel = channel
Exemplo n.º 46
0
 def __init__(self):
     Task.__init__(self)
     self.name="StopClientTask"
     self.description="this task is used to stop client script"
     self.stat = self.RUNNING
     self.info = "stop client scripts is running"
Exemplo n.º 47
0
 def __init__(self):
     Task.__init__(self)
     self.name="ClearupTask"
     self.description="this task is used to clear an existing iserver build"
     self.stat = self.RUNNING
     self.info = "clearup task is running"
Exemplo n.º 48
0
 def __init__(self):
     Task.__init__(self)
     self.name="StopServerTask"
     self.description="this task is used to stop server"
     self.stat = self.RUNNING
     self.info = "stop Linux server task is running"