def make_task(name='',
              run_name='',
              **kwargs) -> Task:
  """Create task, also create dummy run if not specified."""
  ncluster_globals.task_launched = True

  name = ncluster_globals.auto_assign_task_name_if_needed(name)

  # tmux can't use . for session names
  tmux_session = name.replace('.', '=')
  tmux_window_id = 0
  util.log(f'killing session {tmux_session}')

  if not util.is_set("NCLUSTER_NOKILL_TMUX"):
    os.system(f'tmux kill-session -t {tmux_session}')
  os.system(f'tmux new-session -s {tmux_session} -n {tmux_window_id} -d')

  task = Task(name,
              tmux_session=tmux_session,  # propagate optional args
              run_name=run_name,
              **kwargs)
  ncluster_globals.register_task(task, run_name)
  return task
def make_task ( name = '' , run_name = '' , ** kwargs ) -> Task : ncluster_globals . task_launched = True name = ncluster_globals . auto_assign_task_name_if_needed ( name ) tmux_session = name . replace ( '.' , '=' ) tmux_window_id = 0 util . log ( f'killing session {tmux_session}' ) if not util . is_set ( "NCLUSTER_NOKILL_TMUX" ) : os . system ( f'tmux kill-session -t {tmux_session}' ) os . system ( f'tmux new-session -s {tmux_session} -n {tmux_window_id} -d' ) task = Task ( name , tmux_session = tmux_session , run_name = run_name , ** kwargs ) ncluster_globals . register_task ( task , run_name ) return task
Create task, also create dummy run if not specified.