def __init__(self, shell=None): Configurable.__init__(self, config=shell.config) self._generate_script_magics() Magics.__init__(self, shell=shell) self.job_manager = BackgroundJobManager() self.bg_processes = [] atexit.register(self.kill_bg_processes)
def jobs_manager(): from IPython.lib.backgroundjobs import BackgroundJobManager from IPython.core.magic import register_line_magic from IPython import get_ipython jobs = BackgroundJobManager() @register_line_magic def job(line): ip = get_ipython() jobs.new(line, ip.user_global_ns) return jobs
def __init__(self, shell): super(AnyBodyMagics, self).__init__(shell) self.job_manager = BackgroundJobManager() self.bg_processes = [] atexit.register(self.kill_bg_processes)
def __init__(self, shell=None): super(ScriptMagics, self).__init__(shell=shell) self._generate_script_magics() self.job_manager = BackgroundJobManager() self.bg_processes = [] atexit.register(self.kill_bg_processes)
from IPython import get_ipython from IPython.core.magic import register_line_cell_magic from IPython.lib.backgroundjobs import BackgroundJobManager _job_manager = BackgroundJobManager() @register_line_cell_magic def job(line, cell=None): _job_manager.new(cell or line, get_ipython().user_global_ns) def get_job_manager(): return _job_manager
def __init__(self, shell=None): Configurable.__init__(self, config=shell.config) self._generate_script_magics() Magics.__init__(self, shell=shell) self.job_manager = BackgroundJobManager()