Schedule a mass mail from a template
@param template template name
@param list list name
@param scheduleTime schedule time for the blast
@param blast Blast Object
@throws IOException
328545
public JsonResponse scheduleBlastFromTemplate(String template, String list, Date scheduleTime, Blast blast) throws IOException {
        blast.setCopyTemplate(template);
        blast.setList(list);
        blast.setScheduleTime(scheduleTime);
        return apiPost(blast);
    }
1248285
public static StringTemplate stringTemplate(String template, List<?> args) {
        return stringTemplate(createTemplate(template), args);
    }
640499
public static void write(final String templateFilename, final Map<String, Object> data,
            final Writer writer) {
        Template tmpl = null;
        try {
            /*-
             * note that we don't need to cache templates by ourselves since getTemplate() does that internally already
             */
            tmpl = conf.getTemplate(templateFilename);
        } catch (FileNotFoundException e1) {
            String errMsg = "FileNotFoundException: template file '" + templateFilename
                    + "' not found";
            log.error("{}: {}", errMsg, e1.getMessage());
            throw new AwsMockException(errMsg, e1);
        } catch (IOException e) {
            String errMsg = "IOException: failed to getTemplate (filename is " + templateFilename
                    + ")";
            log.error("{}: {}", errMsg, e.getMessage());
            throw new AwsMockException(errMsg, e);
        }

        try {
            tmpl.process(data, writer);
        } catch (TemplateException e) {
            StringBuilder dataDescription = new StringBuilder();

            if (null != data) {
                for (Map.Entry<String, Object> entry : data.entrySet()) {
                    dataDescription.append(entry.getKey() + " - " + entry.getValue()).append('\n');
                }
            }
            String errMsg = "TemplateException: failed to process template '" + templateFilename
                    + "', with data: "
                    + dataDescription.toString()
                    + " The probable cause could be un-matching of key-values for that template. ";
            log.error("{}: {}", errMsg, e.getMessage());
            throw new AwsMockException(errMsg, e);
        } catch (IOException e) {
            String errMsg = "IOException: failed to process template and write to writer. ";
            log.error("{}: {}", errMsg, e.getMessage());
            throw new AwsMockException(errMsg, e);
        }

    }
540408
public function twigLoadFileTemplate ($template_file = null, $template_dir_list = [], $options = []) {
		if (isset($this->textTemplate)) {
			return $this->twigLoadStringTemplate($this->textTemplate, $template_dir_list);
		}

		$twig = $this->twigTemplateSetting(null, $template_dir_list, $options);
		$this->templateDir = $this->templateDir ?: $this->controller;
		$this->template = $this->template ?: $this->action;

		if ($template_file === null) {
			if (!isset($this->templateFile) || $this->templateFile === null) {
				$this->templateFile = PathTrait::CreateFilePath([implode('.', [Strings::ToSnakeCase($this->template), $this->mimeType, 'twig'])]);
			}
			$template_file = $this->templateFile;
		}

		return $twig->loadTemplate($template_file);
	}
759170
function list (builder, node) {
	finishPending (builder);

	var key = node [1];
	var sub = subBuilder (builder);

	dispatch.nodes (sub, builder.dispatch, node, 2, node.length);

	var template = getTemplate (sub);
	appendNode (builder, spec.listNode (key, template));
}
875515
private ProcTemplate createTemplate(Template template) {
        if (!template.isEmpty()) {
            return new ProcTemplate(templateElementFactory.createTemplateList(template.getElements()));
        } else {
            return ProcTemplate.EMPTY;
        }
    }
264880
public function scheduleBlastFromTemplate($template, $list, $schedule_time, $options = [ ]) {
        $data = $options;
        $data['copy_template'] = $template;
        $data['list'] = $list;
        $data['schedule_time'] = $schedule_time;
        return $this->apiPost('blast', $data);
    }
220190
private ScheduleTaskImpl[] readInAllTasks() throws PageException {
	Element root = doc.getDocumentElement();
	NodeList children = root.getChildNodes();
	ArrayList<ScheduleTaskImpl> list = new ArrayList<ScheduleTaskImpl>();

	int len = children.getLength();
	for (int i = 0; i < len; i++) {
	    Node n = children.item(i);
	    if (n instanceof Element && n.getNodeName().equals("task")) {
		list.add(readInTask((Element) n));
	    }
	}
	return list.toArray(new ScheduleTaskImpl[list.size()]);
    }
1238746
public int writeTemplateEntry(String template, Object entry) {
        int returnCode = htod.writeTemplateEntry(template, entry);
        if (returnCode == HTODDynacache.DISK_EXCEPTION) {
            stopOnError(this.htod.diskCacheException);
        }
        return returnCode;
    }
1235107
public static PredicateTemplate predicateTemplate(String template, Object... args) {
        return predicateTemplate(TemplateFactory.DEFAULT.create(template), ImmutableList.copyOf(args));
    }
174353
protected void list(String[] args) throws Exception {
		LOG.info("Running 'list' command.");

		final Options commandOptions = CliFrontendParser.getListCommandOptions();

		final Options commandLineOptions = CliFrontendParser.mergeOptions(commandOptions, customCommandLineOptions);

		final CommandLine commandLine = CliFrontendParser.parse(commandLineOptions, args, false);

		ListOptions listOptions = new ListOptions(commandLine);

		// evaluate help flag
		if (listOptions.isPrintHelp()) {
			CliFrontendParser.printHelpForList(customCommandLines);
			return;
		}

		final boolean showRunning;
		final boolean showScheduled;
		final boolean showAll;

		// print running and scheduled jobs if not option supplied
		if (!listOptions.showRunning() && !listOptions.showScheduled() && !listOptions.showAll()) {
			showRunning = true;
			showScheduled = true;
			showAll = false;
		} else {
			showRunning = listOptions.showRunning();
			showScheduled = listOptions.showScheduled();
			showAll = listOptions.showAll();
		}

		final CustomCommandLine<?> activeCommandLine = getActiveCustomCommandLine(commandLine);

		runClusterAction(
			activeCommandLine,
			commandLine,
			clusterClient -> listJobs(clusterClient, showRunning, showScheduled, showAll));

	}
1316284
public int writeTemplate(String template, ValueSet vs) {
        int returnCode = htod.writeTemplate(template, vs);
        if (returnCode == HTODDynacache.DISK_EXCEPTION) {
            stopOnError(this.htod.diskCacheException);
        }
        return returnCode;
    }
945745
def async_mail_task(subject_or_message, to=None, template=None, **kwargs):
    
    to = to or kwargs.pop('recipients', [])
    msg = make_message(subject_or_message, to, template, **kwargs)
    with mail.connect() as connection:
        connection.send(msg)
38703
def email_template(rcpt, template_path, **kwargs):
    

    subject, content = parse_template(template_path, **kwargs)
    count = send_mail(subject, content, settings.DEFAULT_FROM_EMAIL,
                      [rcpt], fail_silently=True)
    return bool(count)
1017639
public JsonResponse scheduleBlastFromBlast(Integer blastId, Date scheduleTime, Blast blast) throws IOException {
        blast.setCopyBlast(blastId);
        blast.setScheduleTime(scheduleTime);
        return apiPost(blast);
    }
155581
public int writeTemplate(String template,
                             ValueSet valueSet) {
        final String methodName = "writeTemplate()";
        int rc = NO_EXCEPTION;
        if (valueSet.size() == 0) {
            if (tc.isDebugEnabled())
                Tr.debug(tc, methodName, "cacheName=" + this.cacheName + " valueSet=0");
        }
        if (!this.disableTemplatesSupport) {
            if (delayOffload) {
                ValueSet vs = auxTemplateDependencyTable.getEntries(template);
                if (vs == null) {
                    if (valueSet.size() <= auxTemplateDependencyTable.delayOffloadEntriesLimit) {
                        Result result = writeValueSetEntry(TEMPLATE_ID_DATA, template, null, valueSet, !ADD_IF_NEW);
                        rc = result.returnCode;
                        boolean bComplete = result.bComplete;
                        returnToResultPool(result);
                        if (rc != DISK_EXCEPTION && !bComplete) {
                            rc = auxTemplateDependencyTable.add(template, valueSet);
                        }
                    } else {
                        rc = writeValueSet(TEMPLATE_ID_DATA, template, valueSet, !ALL); // valueSet may be empty after writeValueSet
                        this.cache.getCacheStatisticsListener().templatesOffloadedToDisk(template);
                    }
                } else {
                    vs.union(valueSet);
                    if (vs.size() > auxTemplateDependencyTable.delayOffloadEntriesLimit) {
                        auxTemplateDependencyTable.removeDependency(template);
                        rc = writeValueSet(TEMPLATE_ID_DATA, template, vs, ALL); // valueSet may be empty after writeValueSet
                        if (rc != NO_EXCEPTION) {
                            valueSet.clear();
                            valueSet.addAll(vs);
                        }
                        this.cache.getCacheStatisticsListener().templatesOffloadedToDisk(template);
                    }
                }
            } else {
                rc = writeValueSet(TEMPLATE_ID_DATA, template, valueSet, !ALL); // valueSet may be empty after writeValueSet
            }
        }
        return rc;
    }
2366
public function setTemplate($type, $template)
    {
        if (!is_callable($template)) {
            $template = (string) $template;
        }

        $this->templates[$type] = $template;
    }