Submit a script using Torque library
435463
def pbs_submit(script, queue, headers, resources, envvars)
        attribs = []
        headers.each do |name, value|
          attribs << { name: name, value: value }
        end
        resources.each do |rsc, value|
          attribs << { name: :Resource_List, resource: rsc, value: value }
        end
        unless envvars.empty?
          attribs << {
            name: :Variable_List,
            value: envvars.map {|k,v| "#{k}=#{v}"}.join(",")
          }
        end

        connect do |cid|
          attropl = Torque::Attropl.from_list attribs
          Torque.pbs_submit cid, attropl, script, queue, nil
        end
      end
321817
def script_current_send(self, seq, force_mavlink1=False):
                '''
                

                '''
                return self.send(self.script_current_encode(seq), force_mavlink1=force_mavlink1)
586547
def submit(self, func, *args, **kwargs):
        
        self.op_sequence += 1
        self.sqs.send_message(
            QueueUrl=self.map_queue,
            MessageBody=utils.dumps({'args': args, 'kwargs': kwargs}),
            MessageAttributes={
                'sequence_id': {
                    'StringValue': str(self.op_sequence),
                    'DataType': 'Number'},
                'op': {
                    'StringValue': named(func),
                    'DataType': 'String',
                },
                'ser': {
                    'StringValue': 'json',
                    'DataType': 'String'}}
        )

        self.futures[self.op_sequence] = f = SQSFuture(
            self.op_sequence)
        return f
163050
def submit(command_filename, workingdir, send_mail = False, username = None):
    ''''''
    return sge_interface.submit(command_filename, workingdir, send_mail = send_mail, username = username)
366567
public void submit(final String script, final Boolean showHeader) throws Exception {
        this.done();
        if (MapReduceFormat.class.isAssignableFrom(this.graph.getGraphOutputFormat())) {
            this.state.assertNotLocked();
            ((Class<? extends MapReduceFormat>) this.graph.getGraphOutputFormat()).getConstructor().newInstance().addMapReduceJobs(this.compiler);
        }
        this.compiler.completeSequence();
        ToolRunner.run(this.compiler, new String[]{script, showHeader.toString()});
    }
400654
public void createDB() throws PlatformException
    {
        if (_creationScript == null)
        {
            createCreationScript();
        }

        Project             project    = new Project();
        TorqueDataModelTask modelTask  = new TorqueDataModelTask();
        File                tmpDir     = null;
        File                scriptFile = null;
        
        try
        {
            tmpDir = new File(getWorkDir(), "schemas");
            tmpDir.mkdir();

            scriptFile = new File(tmpDir, CREATION_SCRIPT_NAME);

            writeCompressedText(scriptFile, _creationScript);

            project.setBasedir(tmpDir.getAbsolutePath());

            // we use the ant task 'sql' to perform the creation script
	        SQLExec         sqlTask = new SQLExec();
	        SQLExec.OnError onError = new SQLExec.OnError();
	
	        onError.setValue("continue");
	        sqlTask.setProject(project);
	        sqlTask.setAutocommit(true);
	        sqlTask.setDriver(_jcd.getDriver());
	        sqlTask.setOnerror(onError);
	        sqlTask.setUserid(_jcd.getUserName());
	        sqlTask.setPassword(_jcd.getPassWord() == null ? "" : _jcd.getPassWord());
	        sqlTask.setUrl(getDBCreationUrl());
	        sqlTask.setSrc(scriptFile);
	        sqlTask.execute();

	        deleteDir(tmpDir);
        }
        catch (Exception ex)
        {
            // clean-up
            if ((tmpDir != null) && tmpDir.exists())
            {
                try
                {
                    scriptFile.delete();
                }
                catch (NullPointerException e) 
                {
                    LoggerFactory.getLogger(this.getClass()).error("NPE While deleting scriptFile [" + scriptFile.getName() + "]", e);
                }
            }
            throw new PlatformException(ex);
        }
    }
53832
private void submitTask(@NotNull State<T, R> state, @NotNull BatchItem item, @NotNull Link auth) {
    // Submit task
    final StateHolder holder = new StateHolder(state);
    try {
      state.auth = auth;
      final Work<R> worker = objectTask(state, item);
      if (state.future.isDone()) {
        holder.close();
        return;
      }
      if (worker == null) {
        throw new IllegalStateException("Uncompleted task worker is null: " + item);
      }
      executeInPool(
          "task: " + state.getMeta().getOid(),
          () -> processObject(state, auth, worker),
          holder::close,
          true
      );
    } catch (Throwable e) {
      holder.close();
      throw e;
    }
  }
1152322
def run(self, input_fname, ids_per_job, stagger=0, **wait_params):
        
        submit_thread = Thread(target=self.submit_reading,
                               args=(input_fname, 0, None, ids_per_job),
                               kwargs={'stagger': stagger},
                               daemon=True)
        submit_thread.start()
        self.watch_and_wait(**wait_params)
        submit_thread.join(0)
        if submit_thread.is_alive():
            logger.warning("Submit thread is still running even after job"
                           "completion.")
        return
236541
def submit(self, fn, *args, **kwargs):
        """"""
        corofn = asyncio.coroutine(lambda: fn(*args, **kwargs))
        return run_coroutine_threadsafe(corofn(), self.loop)
1117670
def submit(xml_root, submit_config, session, dry_run=None, **kwargs):
    """"""
    properties.xunit_fill_testrun_id(xml_root, kwargs.get("testrun_id"))
    if dry_run is not None:
        properties.set_dry_run(xml_root, dry_run)
    xml_input = utils.etree_to_string(xml_root)

    logger.info("Submitting data to %s", submit_config.submit_target)
    files = {"file": ("results.xml", xml_input)}
    try:
        response = session.post(submit_config.submit_target, files=files)
    # pylint: disable=broad-except
    except Exception as err:
        logger.error(err)
        response = None

    return SubmitResponse(response)
707810
@Override
    public String dialogScriptSubmit() {

        if (useNewStyle()) {
            return super.dialogScriptSubmit();
        }
        StringBuffer result = new StringBuffer(512);
        result.append("function submitAction(actionValue, theForm, formName) {\n");
        result.append("\tif (theForm == null) {\n");
        result.append("\t\ttheForm = document.forms[formName];\n");
        result.append("\t}\n");
        result.append("\ttheForm." + PARAM_FRAMENAME + ".value = window.name;\n");
        result.append("\tif (actionValue == \"" + DIALOG_OK + "\") {\n");
        result.append("\t\treturn true;\n");
        result.append("\t}\n");
        result.append("\ttheForm." + PARAM_ACTION + ".value = actionValue;\n");
        result.append("\ttheForm.submit();\n");
        result.append("\treturn false;\n");
        result.append("}\n");

        return result.toString();
    }
604127
def _job_done_callback(self, submissionid, task, result, grade, problems, tests, custom, state, archive, stdout, stderr, newsub=True):
        
        submission = self.get_submission(submissionid, False)
        submission = self.get_input_from_submission(submission)

        data = {
            "status": ("done" if result[0] == "success" or result[0] == "failed" else "error"),
             # error only if error was made by INGInious
            "result": result[0],
            "grade": grade,
            "text": result[1],
            "tests": tests,
            "problems": problems,
            "archive": (self._gridfs.put(archive) if archive is not None else None),
            "custom": custom,
            "state": state,
            "stdout": stdout,
            "stderr": stderr
        }

        unset_obj = {
            "jobid": "",
            "ssh_host": "",
            "ssh_port": "",
            "ssh_password": ""
        }

        # Save submission to database
        submission = self._database.submissions.find_one_and_update(
            {"_id": submission["_id"]},
            {"$set": data, "$unset": unset_obj},
            return_document=ReturnDocument.AFTER
        )

        self._hook_manager.call_hook("submission_done", submission=submission, archive=archive, newsub=newsub)

        for username in submission["username"]:
            self._user_manager.update_user_stats(username, task, submission, result[0], grade, state, newsub)

        if "outcome_service_url" in submission and "outcome_result_id" in submission and "outcome_consumer_key" in submission:
            for username in submission["username"]:
                self._lti_outcome_manager.add(username,
                                              submission["courseid"],
                                              submission["taskid"],
                                              submission["outcome_consumer_key"],
                                              submission["outcome_service_url"],
                                              submission["outcome_result_id"])
596761
async def run_script(self, script):
        """"""
        script = os.linesep.join(['set -x', 'set +B', script, 'exit']) + os.linesep
        self.proc.stdin.write(script.encode('utf-8'))
        await self.proc.stdin.drain()
        self.proc.stdin.close()
851717
def torque_on(self):
        
        data = []
        data.append(0x0A)
        data.append(self.servoid)
        data.append(RAM_WRITE_REQ)
        data.append(TORQUE_CONTROL_RAM)
        data.append(0x01)
        data.append(0x60)
        send_data(data)
1056832
def enable_torque(self, ids):
        
        self._set_torque_enable(dict(zip(ids, itertools.repeat(True))))
421597
def script_post_save(model, os_path, contents_manager, **kwargs):
    
    from nbconvert.exporters.script import ScriptExporter

    if model['type'] != 'notebook':
        return

    global _script_exporter

    if _script_exporter is None:
        _script_exporter = ScriptExporter(parent=contents_manager)

    log = contents_manager.log

    base, ext = os.path.splitext(os_path)
    # py_fname = base + '.py'
    script, resources = _script_exporter.from_filename(os_path)
    script_fname = base + resources.get('output_extension', '.txt')
    log.info("Saving script /%s", to_api_path(script_fname, contents_manager.root_dir))

    with io.open(script_fname, 'w', encoding='utf-8') as f:
        f.write(script)
449826
function(opt) {
    if (!opt.hasOwnProperty('id')) {
        throw ("Job constructor must be provided an uuid");
    }
    if (this.debugBool) {
        console.log("JOB OPTION CONTENT\n");
        console.dir(opt);
    }
    Core.call(this, opt);
    this.engineHeader = opt.engineHeader;
    this.submitBin = opt.submitBin;
    this.cmd = 'cmd' in opt ? opt.cmd : null; //the set of shell command to sbatch
    this.script = 'script' in opt ? opt.script : null; //the shell script to sbatch
    this.exportVar = 'exportVar' in opt ? opt.exportVar : null; //the shell script variable to export
    this.inputs = 'inputs' in opt ? opt.inputs : null; //the set inputs to copy in the $CWD/input folder
    this.tagTask = 'tagTask' in opt ? opt.tagTask : null;

    this.emulated = 'emulated' in opt ? opt.emulated ? true : false : false;

    this.port = opt.port;
    this.adress = opt.adress;
    this.workDir = opt.workDir;
    this.namespace = opt.namespace ? opt.namespace : null;

    this.cwd = 'cwd' in opt ? opt.cwd : null;
    this.cwdClone = 'cwdClone' in opt ? opt.cwdClone : false;
    this.ttl = 'ttl' in opt ? opt.ttl : null;
    this.ERR_jokers = 3; //  Number of time a job is allowed to be resubmitted if its stderr is non null
    this.MIA_jokers = 3; //  Number of time a job is allowed to not be found in the squeue
    this.modules = 'modules' in opt ? opt.modules : []; //the set of module to load

    this.debugBool = 'debugMode' in opt ? opt.debugMode : false;
    this.inputSymbols = {};
}