当前位置: 首页>>代码示例>>Java>>正文


Java TaskOptions.param方法代码示例

本文整理汇总了Java中com.google.appengine.api.taskqueue.TaskOptions.param方法的典型用法代码示例。如果您正苦于以下问题:Java TaskOptions.param方法的具体用法?Java TaskOptions.param怎么用?Java TaskOptions.param使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.google.appengine.api.taskqueue.TaskOptions的用法示例。


在下文中一共展示了TaskOptions.param方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: export

import com.google.appengine.api.taskqueue.TaskOptions; //导入方法依赖的package包/类
public void export(BigQueryMetric metric) {
  try {
    String hostname = modulesService.getVersionHostname("backend", null);
    TaskOptions opts =
        withUrl(MetricsExportAction.PATH)
            .header("Host", hostname)
            .param("insertId", idGenerator.get());
    for (Entry<String, String> entry : metric.getBigQueryRowEncoding().entrySet()) {
      opts.param(entry.getKey(), entry.getValue());
    }
    opts.param("tableId", metric.getTableId());
    queue.add(opts);
  } catch (TransientFailureException e) {
    // Log and swallow. We may drop some metrics here but this should be rare.
    logger.info(e, e.getMessage());
  }
}
 
开发者ID:google,项目名称:nomulus,代码行数:18,代码来源:BigQueryMetricsEnqueuer.java

示例2: makeTaskOptions

import com.google.appengine.api.taskqueue.TaskOptions; //导入方法依赖的package包/类
/**
 * Generates the TaskOptions needed to trigger an AppEngine Datastore backup job.
 *
 * @see <a href="https://developers.google.com/appengine/articles/scheduled_backups">Scheduled Backups</a>
 */
private static TaskOptions makeTaskOptions(
    String queue, String name, String gcsBucket, ImmutableSet<String> kinds) {
  String hostname = modulesService.getVersionHostname("default", DATASTORE_ADMIN_VERSION_NAME);
  TaskOptions options = TaskOptions.Builder.withUrl("/_ah/datastore_admin/backup.create")
      .header("Host", hostname)
      .method(Method.GET)
      .param("name", name + "_")  // Add underscore since the name will be used as a prefix.
      .param("filesystem", "gs")
      .param("gs_bucket_name", gcsBucket)
      .param("queue", queue);
  for (String kind : kinds) {
    options.param("kind", kind);
  }
  return options;
}
 
开发者ID:google,项目名称:nomulus,代码行数:21,代码来源:DatastoreBackupService.java

示例3: enqueueTask

import com.google.appengine.api.taskqueue.TaskOptions; //导入方法依赖的package包/类
@Override
public void enqueueTask(String taskName, Map<String, String[]> paramMap) {

  checkNotNull(taskName);

  final Queue queue = QueueFactory.getDefaultQueue();
  final TaskOptions options = TaskOptions.Builder.withUrl(String.format(PATH_ADMIN_TASK, taskName));

  for (Map.Entry<String, String[]> param : paramMap.entrySet()) {
    for (String value : param.getValue()) {
      options.param(param.getKey(), value);
    }
  }

  try {
    queue.add(options);
    LOGGER.info("Added admin task to queue {}", taskName);
  } catch (TransientFailureException tfe) {
    LOGGER.error("Run admin task fail {} ", tfe.getMessage());
  }

}
 
开发者ID:Wadpam,项目名称:guja,代码行数:23,代码来源:GAEAdminTaskQueue.java

示例4: addDeferredTask

import com.google.appengine.api.taskqueue.TaskOptions; //导入方法依赖的package包/类
/**
 * Adds the given task, to be run after the specified time, to the specified queue.
 *
 * @param task the task object containing the details of task to be added
 * @param countdownTime the time delay for the task to be executed
 */
public void addDeferredTask(TaskWrapper task, long countdownTime) {
    Queue requiredQueue = QueueFactory.getQueue(task.getQueueName());
    TaskOptions taskToBeAdded = TaskOptions.Builder.withUrl(task.getWorkerUrl());
    if (countdownTime > 0) {
        taskToBeAdded.countdownMillis(countdownTime);
    }

    for (Map.Entry<String, String[]> entry : task.getParamMap().entrySet()) {
        String name = entry.getKey();
        String[] values = entry.getValue();

        for (String value : values) {
            taskToBeAdded = taskToBeAdded.param(name, value);
        }
    }

    requiredQueue.add(taskToBeAdded);
}
 
开发者ID:TEAMMATES,项目名称:teammates,代码行数:25,代码来源:TaskQueuesLogic.java

示例5: createBackupTaskOptions

import com.google.appengine.api.taskqueue.TaskOptions; //导入方法依赖的package包/类
private TaskOptions createBackupTaskOptions(String backupName, List<String> kindsToExport, String bucketName, String queueName) {
	TaskOptions t = TaskOptions.Builder.withUrl("/_ah/datastore_admin/backup.create");
	t.param("name", backupName);
	for (String kind : kindsToExport) {
		t.param("kind", kind);
	}
	t.param("filesystem", "gs");
	t.param("gs_bucket_name", bucketName);
	
	t.param("queue", queueName);
	
	t.method(Method.GET);
	t.header("Host", BackendServiceFactory.getBackendService().getBackendAddress(AH_BUILTIN_PYTHON_BUNDLE));
	
	return t;
}
 
开发者ID:steveseo,项目名称:l2bq,代码行数:17,代码来源:BuiltinDatastoreToBigqueryCronTask.java

示例6: requestMagicLink

import com.google.appengine.api.taskqueue.TaskOptions; //导入方法依赖的package包/类
public void requestMagicLink(String loginIdentifier, String next) {
    Route route = router.getNamedRoute("task.notify.sendMagicLink");
    TaskOptions taskOptions = TaskOptions.Builder
        .withUrl(route.getRoute())
        .param("loginIdentifier", loginIdentifier);
    if (next != null) {
        taskOptions = taskOptions.param("next", next);
    }
    queue.add(ofy().getTransaction(), taskOptions);
}
 
开发者ID:3wks,项目名称:generator-thundr-gae-react,代码行数:11,代码来源:MagicLinkService.java

示例7: createRefreshTask

import com.google.appengine.api.taskqueue.TaskOptions; //导入方法依赖的package包/类
private static TaskOptions createRefreshTask(String name, TargetType type) {
  TaskOptions options = TaskOptions.Builder
      .withMethod(Method.PULL)
      .param(DNS_TARGET_TYPE_PARAM, type.toString())
      .param(DNS_TARGET_NAME_PARAM, name);
  String tld = InternetDomainName.from(name).parts().reverse().get(0);
  return options.param("tld", tld);
}
 
开发者ID:google,项目名称:nomulus,代码行数:9,代码来源:ReadDnsQueueActionTest.java

示例8: register_customTask

import com.google.appengine.api.taskqueue.TaskOptions; //导入方法依赖的package包/类
/**
 * Registers a custom task in the custom queue.
 * @param paramMap map of parameters to store
 */
public static void register_customTask( final java.util.Map< String, String > paramMap ) {
	final TaskOptions taskOptions = buildTask( OPERATION_CUSTOM );
	
	for ( final Entry< String, String > paramEntry : paramMap.entrySet() )
		taskOptions.param( paramEntry.getKey(), paramEntry.getValue() );
	
	QueueFactory.getQueue( QUEUE_NAME_CUSTOM ).add( taskOptions );
}
 
开发者ID:icza,项目名称:sc2gears,代码行数:13,代码来源:TaskServlet.java

示例9: queueTask

import com.google.appengine.api.taskqueue.TaskOptions; //导入方法依赖的package包/类
public void queueTask(String url, String cursorStr) {
    TaskOptions taskOptions = TaskOptions.Builder
            .withMethod(TaskOptions.Method.GET)
            .url(url)
            .retryOptions(RetryOptions.Builder.withTaskRetryLimit(0));

    if(cursorStr != null) {
        taskOptions.param("cursor", cursorStr);
    }

    Queue queue = QueueFactory.getDefaultQueue();
    queue.add(taskOptions);
}
 
开发者ID:ipeirotis,项目名称:mturk-surveys,代码行数:14,代码来源:MergeAnswersServlet.java

示例10: queueTask

import com.google.appengine.api.taskqueue.TaskOptions; //导入方法依赖的package包/类
public static void queueTask(String url, String hitId) {
    TaskOptions taskOptions = TaskOptions.Builder
            .withMethod(TaskOptions.Method.GET)
            .url(url)
            .retryOptions(RetryOptions.Builder.withTaskRetryLimit(0));

    if(hitId != null) {
        taskOptions.param("hitId", hitId);
    }

    Queue queue = QueueFactory.getDefaultQueue();
    queue.add(taskOptions);
}
 
开发者ID:ipeirotis,项目名称:mturk-surveys,代码行数:14,代码来源:AddHitCreationDateToUserAnswerServlet.java

示例11: queueTask

import com.google.appengine.api.taskqueue.TaskOptions; //导入方法依赖的package包/类
public void queueTask(String surveyId, boolean production) {
    TaskOptions taskOptions = TaskOptions.Builder
            .withMethod(TaskOptions.Method.GET)
            .url("/tasks/createHIT")
            .retryOptions(RetryOptions.Builder.withTaskRetryLimit(0));

    taskOptions.param("surveyId", surveyId);
    taskOptions.param("production", String.valueOf(production));

    Queue queue = QueueFactory.getDefaultQueue();
    queue.add(taskOptions);
}
 
开发者ID:ipeirotis,项目名称:mturk-surveys,代码行数:13,代码来源:CreateHITServlet.java

示例12: enqueueTask

import com.google.appengine.api.taskqueue.TaskOptions; //导入方法依赖的package包/类
private static void enqueueTask(String baseUrl, BuiltinDatastoreExportConfiguration exporterConfig, long timestamp, long countdownMillis) {
	TaskOptions t = TaskOptions.Builder.withUrl(baseUrl + BUILTIN_DATASTORE_TO_BIGQUERY_INGESTOR_TASK_PATH);
	t.param(AnalysisConstants.TIMESTAMP_PARAM, Long.toString(timestamp));
	t.param(AnalysisConstants.BUILTIN_DATASTORE_EXPORT_CONFIG, exporterConfig.getClass().getName());
	
	t.method(Method.GET);
	if (countdownMillis > 0) {
		t.countdownMillis(countdownMillis);
	}
	QueueFactory.getQueue(exporterConfig.getQueueName()).add(t);
}
 
开发者ID:steveseo,项目名称:l2bq,代码行数:12,代码来源:BuiltinDatastoreToBigqueryIngesterTask.java

示例13: perform

import com.google.appengine.api.taskqueue.TaskOptions; //导入方法依赖的package包/类
@Override
public Page perform(HttpServletRequest req, HttpServletResponse resp)
		throws IOException {
	String cursor = req.getParameter("cursor");

	Objectify ob = DefaultServlet.getObjectify();
	Query<PackageVersion> q = ob.query(PackageVersion.class);
	if (cursor != null)
		q.startCursor(Cursor.fromWebSafeString(cursor));
	q.limit(100);

	QueryResultIterator<PackageVersion> iterator = q.iterator();

	int n = 0;
	List<PackageVersion> list = new ArrayList<PackageVersion>();
	while (iterator.hasNext()) {
		PackageVersion data = iterator.next();
		list.add(data);
		n++;
	}

	ob.put(list);

	if (n == 100) {
		cursor = iterator.getCursor().toWebSafeString();
	} else {
		cursor = null;
		NWUtils.sendMailToAdmin("cursor == nul for /tasks/resave-package-version");
	}

	Queue queue = QueueFactory.getQueue("resave");
	try {
		TaskOptions to = withUrl("/tasks/resave-package-versions");
		if (cursor != null)
			to.param("cursor", cursor);

		queue.add(to);
	} catch (TaskAlreadyExistsException e) {
		NWUtils.LOG
				.warning("task /tasks/resave-package-version already exists");
	}

	resp.setStatus(200);
	return null;
}
 
开发者ID:tim-lebedkov,项目名称:npackd-gae-web,代码行数:46,代码来源:ForEachPackageVersionAction.java

示例14: perform

import com.google.appengine.api.taskqueue.TaskOptions; //导入方法依赖的package包/类
@Override
public Page perform(HttpServletRequest req, HttpServletResponse resp)
        throws IOException {
    String cursor = req.getParameter("cursor");

    Objectify ob = DefaultServlet.getObjectify();
    Query<Package> q = ob.query(Package.class);
    if (cursor != null) {
        q.startCursor(Cursor.fromWebSafeString(cursor));
    }
    q.limit(1);

    QueryResultIterator<Package> iterator = q.iterator();
    Package data;
    if (iterator.hasNext()) {
        data = iterator.next();
    } else {
        data = null;
    }
    if (data != null) {
        Package old = data.copy();
        NWUtils.LOG.log(Level.INFO, "check-update for {0}", data.name);
        Date noUpdatesCheck = null;
        if ("0".equals(req.getHeader("X-AppEngine-TaskRetryCount"))) {
            try {
                Version v = data.findNewestVersion();
                List<PackageVersion> versions = data.getSortedVersions(ob);
                if (versions.size() > 0) {
                    PackageVersion pv = versions.get(versions.size() - 1);
                    int r = v.compare(Version.parse(pv.version));
                    if (r == 0) {
                        noUpdatesCheck = NWUtils.newDate();
                    } else if (r > 0) {
                        data.createDetectedVersion(ob, v, 0);
                    }
                }
            } catch (IOException e) {
                // ignore
            }
        }

        if (noUpdatesCheck != null || data.noUpdatesCheck != null) {
            data.noUpdatesCheck = noUpdatesCheck;
            NWUtils.savePackage(ob, old, data, false);
        }

        NWUtils.LOG.log(Level.INFO, "check-update noUpdatesCheck= {0}",
                data.noUpdatesCheck);

        cursor = iterator.getCursor().toWebSafeString();
    } else {
        cursor = null;
    }

    Queue queue = QueueFactory.getQueue("check-update");
    TaskOptions to = withUrl("/tasks/check-update");
    if (cursor != null) {
        to.param("cursor", cursor);
    }

    // 2 minutes
    to.countdownMillis(2 * 60 * 1000);

    // NWUtils.LOG.warning("adding task at cursor " + cursor);
    queue.add(to);

    resp.setStatus(200);
    return null;
}
 
开发者ID:tim-lebedkov,项目名称:npackd-gae-web,代码行数:70,代码来源:CheckUpdatesAction.java

示例15: addProperties

import com.google.appengine.api.taskqueue.TaskOptions; //导入方法依赖的package包/类
private static void addProperties(TaskOptions taskOptions, Properties properties) {
  for (String paramName : properties.stringPropertyNames()) {
    String paramValue = properties.getProperty(paramName);
    taskOptions.param(paramName, paramValue);
  }
}
 
开发者ID:GoogleCloudPlatform,项目名称:appengine-pipelines,代码行数:7,代码来源:AppEngineTaskQueue.java


注:本文中的com.google.appengine.api.taskqueue.TaskOptions.param方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。