Ejemplo n.º 1
0
    def _slice(self, profilename, inputpath, outputpath, preprocessor,
               with_start_end, slicer_settings, material):
        self._log.debug(
            'profilename=%r, inputpath=%r, outputpath=%r, preprocessor=%r, with_start_end=%r, slicer_settings=%r, material=%r',
            profilename, inputpath, outputpath, preprocessor, with_start_end,
            slicer_settings, material)
        slicer_settings = conveyor.domain.SlicerConfiguration.fromdict(
            slicer_settings)
        recipemanager = conveyor.recipe.RecipeManager(self._server,
                                                      self._config)
        build_name = self._getbuildname(inputpath)
        profile = self._findprofile(profilename)
        job = self._server.createjob(build_name, inputpath, self._config, None,
                                     profile, preprocessor, False,
                                     with_start_end, slicer_settings, material)
        recipe = recipemanager.getrecipe(job)
        process = recipe.slice(profile, outputpath)
        job.process = process

        def startcallback(task):
            self._server.addjob(job)

        process.startevent.attach(startcallback)

        def runningcallback(task):
            self._log.info('slicing: %s -> %s (job %d)', inputpath, outputpath,
                           job.id)

        process.runningevent.attach(runningcallback)

        def heartbeatcallback(task):
            childtask = task.progress
            progress = childtask.progress
            job.currentstep = progress
            job.state = task.state
            job.conclusion = task.conclusion
            self._server.changejob(job)
            self._log.info('progress: (job %d) %r', job.id, progress)

        process.heartbeatevent.attach(heartbeatcallback)
        process.stoppedevent.attach(self._stoppedcallback(job))
        process.start()
        dct = job.todict()
        return dct
Ejemplo n.º 2
0
 def slice(
         self, driver_name, profile_name, input_file, output_file,
         add_start_end, extruder_name, gcode_processor_name, material_name,
         slicer_name, slicer_settings):
     job_id = self._create_job_id()
     job_name = self._get_job_name(output_file)
     driver = self._driver_manager.get_driver(driver_name)
     profile = driver.get_profile(profile_name)
     job = conveyor.job.SliceJob(
         job_id, job_name, driver, profile, input_file, output_file,
         add_start_end, extruder_name, gcode_processor_name,
         material_name, slicer_name, slicer_settings)
     recipe_manager = conveyor.recipe.RecipeManager(
         self._config, self, self._spool)
     recipe = recipe_manager.get_recipe(job)
     job.task = recipe.slice()
     self._attach_job_callbacks(job)
     job.task.start()
     return job
Ejemplo n.º 3
0
 def slice(self, driver_name, profile_name, input_file, output_file,
           add_start_end, extruder_name, gcode_processor_name,
           material_name, slicer_name, slicer_settings):
     job_id = self._create_job_id()
     job_name = self._get_job_name(output_file)
     driver = self._driver_manager.get_driver(driver_name)
     profile = driver.get_profile(profile_name)
     job = conveyor.job.SliceJob(job_id, job_name, driver, profile,
                                 input_file, output_file, add_start_end,
                                 extruder_name, gcode_processor_name,
                                 material_name, slicer_name,
                                 slicer_settings)
     recipe_manager = conveyor.recipe.RecipeManager(self._config, self,
                                                    self._spool)
     recipe = recipe_manager.get_recipe(job)
     job.task = recipe.slice()
     self._attach_job_callbacks(job)
     job.task.start()
     return job
Ejemplo n.º 4
0
 def _slice(
     self, profilename, inputpath, outputpath, preprocessor,
     with_start_end, slicer_settings, material):
         self._log.debug(
             'profilename=%r, inputpath=%r, outputpath=%r, preprocessor=%r, with_start_end=%r, slicer_settings=%r, material=%r',
             profilename, inputpath, outputpath, preprocessor,
             with_start_end, slicer_settings, material)
         slicer_settings = conveyor.domain.SlicerConfiguration.fromdict(slicer_settings)
         recipemanager = conveyor.recipe.RecipeManager(
             self._server, self._config)
         build_name = self._getbuildname(inputpath)
         profile = self._findprofile(profilename)
         job = self._server.createjob(
             build_name, inputpath, self._config, None, profile,
             preprocessor, False, with_start_end, slicer_settings,
             material)
         recipe = recipemanager.getrecipe(job)
         process = recipe.slice(profile, outputpath)
         job.process = process
         def startcallback(task):
             self._server.addjob(job)
         process.startevent.attach(startcallback)
         def runningcallback(task):
             self._log.info(
                 'slicing: %s -> %s (job %d)', inputpath, outputpath,
                 job.id)
         process.runningevent.attach(runningcallback)
         def heartbeatcallback(task):
             childtask = task.progress
             progress = childtask.progress
             job.currentstep = progress
             job.state = task.state
             job.conclusion = task.conclusion
             self._server.changejob(job)
             self._log.info('progress: (job %d) %r', job.id, progress)
         process.heartbeatevent.attach(heartbeatcallback)
         process.stoppedevent.attach(self._stoppedcallback(job))
         process.start()
         dct = job.todict()
         return dct