コード例 #1
0
    def _print(self, printername, inputpath, preprocessor, skip_start_end,
               archive_lvl, archive_dir, slicer_settings, material):
        self._log.debug(
            'printername=%r, inputpath=%r, preprocessor=%r, skip_start_end=%r, archive_lvl=%r, archive_dir=%r, slicer_settings=%r, material=%r',
            printername, inputpath, preprocessor, skip_start_end, archive_lvl,
            archive_dir, slicer_settings, material)
        slicer_settings = conveyor.domain.SlicerConfiguration.fromdict(
            slicer_settings)
        recipemanager = conveyor.recipe.RecipeManager(self._server,
                                                      self._config)
        build_name = self._getbuildname(inputpath)
        printerthread = self._findprinter(printername)
        printerid = printerthread.getprinterid()
        profile = printerthread.getprofile()
        job = self._server.createjob(build_name, inputpath, self._config,
                                     printerid, profile, preprocessor,
                                     skip_start_end, False, slicer_settings,
                                     material)
        recipe = recipemanager.getrecipe(job)
        process = recipe.print(printerthread)
        job.process = process

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

        process.startevent.attach(startcallback)

        def runningcallback(task):
            self._log.info('printing: %s (job %d)', inputpath, 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
コード例 #2
0
ファイル: __init__.py プロジェクト: nmsl1993/conveyor
 def _print(
     self, printername, inputpath, preprocessor, skip_start_end, archive_lvl,
     archive_dir, slicer_settings, material):
         self._log.debug(
             'printername=%r, inputpath=%r, preprocessor=%r, skip_start_end=%r, archive_lvl=%r, archive_dir=%r, slicer_settings=%r, material=%r',
             printername, inputpath, preprocessor, skip_start_end,
             archive_lvl, archive_dir, slicer_settings, material)
         slicer_settings = conveyor.domain.SlicerConfiguration.fromdict(slicer_settings)
         recipemanager = conveyor.recipe.RecipeManager(
             self._server, self._config)
         build_name = self._getbuildname(inputpath)
         printerthread = self._findprinter(printername)
         printerid = printerthread.getprinterid()
         profile = printerthread.getprofile()
         job = self._server.createjob(
             build_name, inputpath, self._config, printerid, profile,
             preprocessor, skip_start_end, False, slicer_settings,
             material)
         recipe = recipemanager.getrecipe(job)
         process = recipe.print(printerthread)
         job.process = process
         def startcallback(task):
             self._server.addjob(job)
         process.startevent.attach(startcallback)
         def runningcallback(task):
             self._log.info(
                 'printing: %s (job %d)', inputpath, 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
コード例 #3
0
 def print(self, machine_name, input_file, extruder_name,
           gcode_processor_name, has_start_end, material_name, slicer_name,
           slicer_settings):
     job_id = self._create_job_id()
     job_name = self._get_job_name(input_file)
     machine = self._find_machine(machine_name, None, None, None)
     if self._is_print_queued(machine) or not machine.is_idle():
         raise conveyor.error.PrintQueuedException
     else:
         job = conveyor.job.PrintJob(job_id, job_name, machine, input_file,
                                     extruder_name, gcode_processor_name,
                                     has_start_end, 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.print()
         self._attach_job_callbacks(job)
         self._attach_print_queued_callbacks(machine, job)
         job.task.start()
         return job
コード例 #4
0
ファイル: __init__.py プロジェクト: Jnesselr/conveyor
 def print(
         self, machine_name, input_file, extruder_name,
         gcode_processor_name, has_start_end, material_name, slicer_name,
         slicer_settings):
     job_id = self._create_job_id()
     job_name = self._get_job_name(input_file)
     machine = self._find_machine(machine_name, None, None, None)
     if self._is_print_queued(machine) or not machine.is_idle():
         raise conveyor.error.PrintQueuedException
     else:
         job = conveyor.job.PrintJob(
             job_id, job_name, machine, input_file, extruder_name,
             gcode_processor_name, has_start_end, 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.print()
         self._attach_job_callbacks(job)
         self._attach_print_queued_callbacks(machine, job)
         job.task.start()
         return job