Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Sign in
Toggle navigation
N
node-bigstream
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
3
Merge Requests
3
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
bs
node-bigstream
Commits
56a7ab0f
Commit
56a7ab0f
authored
Jan 27, 2017
by
project
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
--no commit message
--no commit message
parent
79bdde61
Show whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
74 additions
and
9 deletions
+74
-9
excute.js
plugins/di/di-agritronics/excute.js
+65
-0
index.js
plugins/di/di-agritronics/index.js
+1
-1
perform.js
plugins/di/di-agritronics/perform.js
+0
-0
index.js
plugins/di/di-example/index.js
+1
-1
perform.js
plugins/di/di-example/perform.js
+2
-2
index.js
plugins/di/di-gistda-air/index.js
+1
-1
perform.js
plugins/di/di-gistda-air/perform.js
+0
-0
index.js
plugins/di/di-http-request/index.js
+1
-1
perform.js
plugins/di/di-http-request/perform.js
+0
-0
di-plugin.js
plugins/di/di-plugin.js
+2
-2
dir.json
test/jobs/dir.json
+1
-1
No files found.
plugins/di/di-agritronics/excute.js
0 → 100644
View file @
56a7ab0f
var
request
=
require
(
'request'
);
var
async
=
require
(
'async'
);
function
execute_function
(
context
,
response
){
var
job_id
=
context
.
jobconfig
.
job_id
;
var
transaction_id
=
context
.
transaction_id
;
var
param
=
context
.
jobconfig
.
data_in
.
param
;
var
memstore
=
context
.
task
.
memstore
;
var
output_type
=
'object/agritronics'
;
var
data
=
'hello world'
;
let
result
=
{
"object_type"
:
'agritronic'
,
"station_id"
:
param
.
station_id
,
"data"
:[]
};
let
idx
=
0
;
//console.log(json_table.length);
async
.
whilst
(
function
()
{
return
idx
<
param
.
data_types
.
length
;},
function
(
callback
)
{
let
dtype
=
param
.
data_types
[
idx
].
type
;
let
node_id
=
param
.
data_types
[
idx
].
node_id
;
let
ts
=
memstore
.
getItem
(
`
${
param
.
station_id
}
-
${
dtype
}
`
);
if
(
typeof
(
ts
)
===
'undefined'
)
ts
=
`
${
param
.
init_observed_date
}
,
${
param
.
init_observed_time
}
`
;
let
url
=
param
.
url
+
`?appkey=
${
param
.
appkey
}
&p=
${
param
.
station_id
}
,
${
node_id
}
,
${
dtype
}
,
${
ts
}
`
;
idx
++
;
getData
(
url
).
then
((
data
)
=>
{
if
(
data
.
search
(
"denied"
)
===
-
1
){
result
.
data
.
push
({
"data_types"
:
dtype
,
"value"
:
data
});
callback
();
}
}).
catch
((
err
)
=>
{
callback
(
err
);
});
},
function
(
err
)
{
if
(
err
)
{
response
.
error
(
err
);
}
else
{
//console.log(JSON.stringify(result));
response
.
success
(
result
,
output_type
);
}
});
}
function
getData
(
url
)
{
return
new
Promise
((
resolve
,
reject
)
=>
{
request
(
url
,
function
(
error
,
resp
,
body
)
{
if
(
!
error
&&
resp
.
statusCode
==
200
)
{
resolve
(
body
);
}
else
{
return
reject
(
error
);
}
})
})
}
module
.
exports
=
execute_function
;
plugins/di/di-agritronics/index.js
View file @
56a7ab0f
...
@@ -8,6 +8,6 @@ function DITask(context){
...
@@ -8,6 +8,6 @@ function DITask(context){
}
}
util
.
inherits
(
DITask
,
DIPlugin
);
util
.
inherits
(
DITask
,
DIPlugin
);
DITask
.
prototype
.
execute
=
require
(
'./execute
'
);
DITask
.
prototype
.
perform
=
require
(
'./perform
'
);
module
.
exports
=
DITask
;
module
.
exports
=
DITask
;
plugins/di/di-agritronics/
execute
.js
→
plugins/di/di-agritronics/
perform
.js
View file @
56a7ab0f
File moved
plugins/di/di-example/index.js
View file @
56a7ab0f
...
@@ -8,6 +8,6 @@ function DITask(context){
...
@@ -8,6 +8,6 @@ function DITask(context){
}
}
util
.
inherits
(
DITask
,
DIPlugin
);
util
.
inherits
(
DITask
,
DIPlugin
);
DITask
.
prototype
.
execute
=
require
(
'./execute
'
);
DITask
.
prototype
.
perform
=
require
(
'./perform
'
);
module
.
exports
=
DITask
;
module
.
exports
=
DITask
;
plugins/di/di-example/
execute
.js
→
plugins/di/di-example/
perform
.js
View file @
56a7ab0f
function
execute
_function
(
context
,
response
){
function
perform
_function
(
context
,
response
){
var
job_id
=
context
.
jobconfig
.
job_id
;
var
job_id
=
context
.
jobconfig
.
job_id
;
var
transaction_id
=
context
.
transaction
.
id
;
var
transaction_id
=
context
.
transaction
.
id
;
var
param
=
context
.
jobconfig
.
data_in
.
param
;
var
param
=
context
.
jobconfig
.
data_in
.
param
;
...
@@ -23,4 +23,4 @@ function execute_function(context,response){
...
@@ -23,4 +23,4 @@ function execute_function(context,response){
}
}
module
.
exports
=
execute
_function
;
module
.
exports
=
perform
_function
;
plugins/di/di-gistda-air/index.js
View file @
56a7ab0f
...
@@ -8,6 +8,6 @@ function DITask(context){
...
@@ -8,6 +8,6 @@ function DITask(context){
}
}
util
.
inherits
(
DITask
,
DIPlugin
);
util
.
inherits
(
DITask
,
DIPlugin
);
DITask
.
prototype
.
execute
=
require
(
'./execute
'
);
DITask
.
prototype
.
perform
=
require
(
'./perform
'
);
module
.
exports
=
DITask
;
module
.
exports
=
DITask
;
plugins/di/di-gistda-air/
execute
.js
→
plugins/di/di-gistda-air/
perform
.js
View file @
56a7ab0f
File moved
plugins/di/di-http-request/index.js
View file @
56a7ab0f
...
@@ -8,6 +8,6 @@ function DITask(context){
...
@@ -8,6 +8,6 @@ function DITask(context){
}
}
util
.
inherits
(
DITask
,
DIPlugin
);
util
.
inherits
(
DITask
,
DIPlugin
);
DITask
.
prototype
.
execute
=
require
(
'./execute
'
);
DITask
.
prototype
.
perform
=
require
(
'./perform
'
);
module
.
exports
=
DITask
;
module
.
exports
=
DITask
;
plugins/di/di-http-request/
execute
.js
→
plugins/di/di-http-request/
perform
.js
View file @
56a7ab0f
File moved
plugins/di/di-plugin.js
View file @
56a7ab0f
...
@@ -15,12 +15,12 @@ DIPlugin.prototype.getname = function(){
...
@@ -15,12 +15,12 @@ DIPlugin.prototype.getname = function(){
return
this
.
name
;
return
this
.
name
;
}
}
DIPlugin
.
prototype
.
execute
=
function
(){}
DIPlugin
.
prototype
.
perform
=
function
(){}
DIPlugin
.
prototype
.
run
=
function
(){
DIPlugin
.
prototype
.
run
=
function
(){
this
.
emit
(
'start'
);
this
.
emit
(
'start'
);
var
resp
=
new
DIResponse
(
this
);
var
resp
=
new
DIResponse
(
this
);
this
.
execute
(
this
.
jobcontext
,
resp
);
this
.
perform
(
this
.
jobcontext
,
resp
);
}
}
module
.
exports
=
DIPlugin
;
module
.
exports
=
DIPlugin
;
...
...
test/jobs/dir.json
View file @
56a7ab0f
...
@@ -14,7 +14,7 @@
...
@@ -14,7 +14,7 @@
"data_out"
:
{
"data_out"
:
{
"type"
:
"dir"
,
"type"
:
"dir"
,
"param"
:
{
"param"
:
{
"path"
:
"D:/test
file
"
"path"
:
"D:/test
data
"
}
}
}
}
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment