我必须使用Google Dataflow Process
中的Google Cloud
函数逐个触发多个模板。执行完一个模板后,必须调用另一个模板。以同步的方式通过云功能触发多数据流作业?
const google = require('googleapis');
exports.goWithTheDataFlow = function(event, callback) {
const file = event.data;
if (file.resourceState === 'exists' && file.name) {
google.auth.getApplicationDefault(function (err, authClient, projectId) {
if (err) {
throw err;
}
if (authClient.createScopedRequired && authClient.createScopedRequired()) {
authClient = authClient.createScoped([
'https://www.googleapis.com/auth/cloud-platform',
'https://www.googleapis.com/auth/userinfo.email'
]);
}
const dataflow = google.dataflow({ version: 'v1b3', auth: authClient });
dataflow.projects.templates.create({
projectId: 'testing1-180111',
resource: {
parameters: {
},
jobName: 'cloud-fn-dataflow-test',
gcsPath: 'gs://kishan-configuration/templates/FinalConfigTable'
}
}, function(err, response) {
if (err) {
console.error("problem running dataflow template, error was: ", err);
}
console.log("Dataflow template response: ", response);
callback();
});
});
}
};
package.json
文件的代码是这样
{
"name": "kishan_kumar464",
"version": "1.0.0",
"main": "index.js",
"dependencies": {
"google-cloud": "^0.56.0",
"googleapis": "^22.2.0"
},
"devDependencies": {},
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"author": "Kishan",
"license": "ISC",
"description": ""
}
我认为你正在寻找工作流管理系统。 看看luigi,Airflow等等的目的 – Anuj
不,我没有可以U请分享LINK,我也在尝试使用Pub/Sub我会在队列中放置一条消息来触发下一个管道 - 使用云端pubsub。 – BackBenChers
Pub/Sub也失败了,因为我们执行PubSub来启动一个新函数在结束我之前调用函数Pipeline.Doesn't重要,当我们呼吁它。我必须使用模板运行我的工作,所以图必须以这种方式定义。 – BackBenChers