find work object specified by name, create and attach it if not exists
761917
static Object workObject(Map<String, Object> workList, String name, boolean isArray) {
        logger.trace("get working object for {}", name);

        if (workList.get(name) != null) return workList.get(name);
        else {
            String[] parts = splitName(name);   // parts: (parent, name, isArray)
            Map<String, Object> parentObj = (Map<String, Object>) workObject(workList, parts[0], false);
            Object theObj = isArray ? new ArrayList<String>() : new HashMap<String, Object>();

            parentObj.put(parts[1], theObj);
            workList.put(name, theObj);

            return theObj;
        }
    }
596143
async def getWorker(self, *args, **kwargs):
        

        return await self._makeApiCall(self.funcinfo["getWorker"], *args, **kwargs)
472030
def create(self, name, **kwargs):
        """"""
        return self._write_op(self._create_nosync, name, **kwargs)
449355
function getWorkQueue(name) {
  var self = this;
  var queue = self._workQueues[name];

  if (!queue) {
    queue = self._workQueues[name] = new WorkQueue();
  }

  return queue;
}
516522
def new_workunit(self, name, labels=None, cmd='', log_config=None):
    
    with self.run_tracker.new_workunit(name=name, labels=labels, cmd=cmd, log_config=log_config) as workunit:
      yield workunit
397945
ActiveFile getOngoingCreates(int namespaceId, Block block) {
    checkBlock(block);
    NamespaceMap nm = getNamespaceMap(namespaceId);
    if (nm == null) {
      return null;
    }
    return nm.getOngoingCreates(block);
  }
858754
def _attachToObject(self, anchorObj, relationName) :
		""
		#MutableSequence.__getattribute__(self, "develop")()
		self.develop()
		self._attachToObject(anchorObj, relationName)
1287569
def _create_worker(self, worker):
        """"""
        worker.sig_started.connect(self._start)
        self._workers.append(worker)
638245
def find_or_create_file(file, name, requires_edit=false)
      if File.exists?(file)
        file
      else
        create_file(file, name, requires_edit)
      end
    end
1185589
def save_task(task_type, target_user, work_object_id = 0, comments = "", subject = "Other")
      params =
        MagicParams.format(
          user_id: @allscripts_username,
          parameter1: task_type,
          parameter2: target_user,
          parameter3: work_object_id,
          parameter4: comments,
          parameter5: subject
        )
      results = magic("SaveTask", magic_params: params)
      results["savetaskinfo"]
    end
382156
def ensure_workdir_exists(context):
    
    ensure_context_attribute_exists(context, "workdir", None)
    if not context.workdir:
        context.workdir = os.path.abspath(WORKDIR)
    pathutil.ensure_directory_exists(context.workdir)
214777
def _get_and_start_work(self):
        ""
        worker_id = nice_identifier()
        work_unit = self.task_master.get_work(worker_id, available_gb=self.available_gb())
        if work_unit is None:
            return None, None
        async_result = self.pool.apply_async(
            run_worker,
            (HeadlessWorker, self.task_master.registry.config,
             worker_id,
             work_unit.work_spec_name,
             work_unit.key),
            callback=self._finish_callback)
        return async_result, work_unit
279146
def create(appname, **kwargs):
        """"""

        if appname in LinkFactory._class_dict:
            return LinkFactory._class_dict[appname].create(**kwargs)
        else:
            raise KeyError(
                "Could not create object associated to app %s" % appname)
789930
def task(name, options = {}, &block)
      name = name.to_s.downcase.to_sym
      task_re = /\A[a-z0-9.:-_]+\z/
      raise "Task already exists: #{name}" if $bot[:tasks].include?(name)
      raise "Task name does not match regexp #{task_re.to_s}" unless name.to_s.match(task_re)

      opts = {
        desc: ''
      }.merge(options)

      $bot[:tasks][name] ||= {
        block: block,
        desc: opts[:desc]
      }
    end
903753
private void postWorkDirectory() {

        // Acquire (or calculate) the work directory path
        String workDir = getWorkDir();
        if (workDir == null || workDir.length() == 0) {

            // Retrieve our parent (normally a host) name
            String hostName = null;
            String engineName = null;
            String hostWorkDir = null;
            Container parentHost = getParent();
            if (parentHost != null) {
                hostName = parentHost.getName();
                if (parentHost instanceof StandardHost) {
                    hostWorkDir = ((StandardHost)parentHost).getWorkDir();
                }
                Container parentEngine = parentHost.getParent();
                if (parentEngine != null) {
                   engineName = parentEngine.getName();
                }
            }
            if ((hostName == null) || (hostName.length() < 1))
                hostName = "_";
            if ((engineName == null) || (engineName.length() < 1))
                engineName = "_";

            String temp = getBaseName();
            if (temp.startsWith("/"))
                temp = temp.substring(1);
            temp = temp.replace('/', '_');
            temp = temp.replace('\\', '_');
            if (temp.length() < 1)
                temp = ContextName.ROOT_NAME;
            if (hostWorkDir != null ) {
                workDir = hostWorkDir + File.separator + temp;
            } else {
                workDir = "work" + File.separator + engineName +
                    File.separator + hostName + File.separator + temp;
            }
            setWorkDir(workDir);
        }

        // Create this directory if necessary
        File dir = new File(workDir);
        if (!dir.isAbsolute()) {
            String catalinaHomePath = null;
            try {
                catalinaHomePath = getCatalinaBase().getCanonicalPath();
                dir = new File(catalinaHomePath, workDir);
            } catch (IOException e) {
                logger.warn(sm.getString("standardContext.workCreateException",
                        workDir, catalinaHomePath, getName()), e);
            }
        }
        if (!dir.mkdirs() && !dir.isDirectory()) {
            logger.warn(sm.getString("standardContext.workCreateFail", dir,
                    getName()));
        }

        // Set the appropriate servlet context attribute
        if (context == null) {
            getServletContext();
        }
        context.setAttribute(ServletContext.TEMPDIR, dir);
//        context.setAttributeReadOnly(ServletContext.TEMPDIR);
    }
796725
def _get_work_spec(self, args):
        ''''''
        with open(args.work_spec_path) as f:
            return yaml.load(f)
1264381
def attach(names, parent, dry_run, verbose):
    """"""
    parent = Collection.query.filter_by(name=parent).one()
    collections = Collection.query.filter(Collection.name.in_(names)).all()
    for collection in collections:
        collection.move_inside(parent.id)
        if verbose:
            click.secho(
                'Collection "{0}" is being attached to "{1}".'.format(
                    collection.name, parent
                ), fg='green')