Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
C
cs425-mp4
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
arshiam2
cs425-mp4
Commits
73c12a15
Commit
73c12a15
authored
6 years ago
by
arshiam2
Browse files
Options
Downloads
Patches
Plain Diff
update
parent
8fe76a5f
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
cli/src/commands/get-stream.js
+44
-0
44 additions, 0 deletions
cli/src/commands/get-stream.js
cli/src/commands/put-stream.js
+4
-2
4 additions, 2 deletions
cli/src/commands/put-stream.js
sfds/index.js
+4
-0
4 additions, 0 deletions
sfds/index.js
with
52 additions
and
2 deletions
cli/src/commands/get-stream.js
0 → 100644
+
44
−
0
View file @
73c12a15
// @flow
const
path
=
require
(
"
path
"
);
const
chalk
=
require
(
"
chalk
"
);
const
fs
=
require
(
"
fs
"
);
const
util
=
require
(
"
util
"
);
const
net
=
require
(
"
net
"
);
const
process
=
require
(
"
process
"
);
var
request
=
require
(
"
request
"
);
var
csv
=
require
(
"
csv-stream
"
);
const
fetch
=
require
(
"
node-fetch
"
);
const
handleErrors
=
require
(
"
../utils/handleErrors
"
);
const
getMaster
=
require
(
"
../utils/getMaster
"
);
module
.
exports
.
command
=
"
put-stream
"
;
module
.
exports
.
describe
=
"
Writes localfilename to the SDFS as sdfsfilename.
"
;
module
.
exports
.
builder
=
(
yargs
:
any
)
=>
yargs
;
module
.
exports
.
handler
=
handleErrors
(
async
(
argv
:
{})
=>
{
const
master
=
await
getMaster
();
getCSVdata
();
setInterval
(
function
sync
()
{
// if (queue.length > 0) {
// const body = queue.pop();
var
target
=
"
http://
"
+
master
+
"
:3000/sink/
"
;
// console.log(target)
// console.log(JSON.stringify(body).state)
fetch
(
target
)
.
then
(
res
=>
console
.
log
(
res
.
text
()))
// .then(json => {
// // if (json.action !== "END") {
// // queue.push(json);
// // } else {
// // console.log(json);
// // }
// });
// }
},
500
);
});
This diff is collapsed.
Click to expand it.
cli/src/commands/put-stream.js
+
4
−
2
View file @
73c12a15
...
...
@@ -40,7 +40,7 @@ async function getCSVdata() {
if
(
messages
.
length
==
10000
)
{
allMessages
.
push
(
messages
);
const
body
=
{
action
:
"
START
"
,
state
:
messages
[
0
]
};
console
.
log
(
body
)
//
console.log(body)
queue
.
push
(
body
);
messages
=
[];
}
...
...
@@ -78,7 +78,9 @@ module.exports.handler = handleErrors(async (argv: {}) => {
// console.log(json);
// }
});
}
}
else
{
process
.
exit
()
}
},
500
);
...
...
This diff is collapsed.
Click to expand it.
sfds/index.js
+
4
−
0
View file @
73c12a15
...
...
@@ -408,6 +408,10 @@ app.post("/spout", function(req, res) {
res
.
send
(
"
got it
"
);
});
app
.
post
(
"
/sink
"
,
function
(
req
,
res
)
{
// console.log("bolt state: " +req.body.state)
res
.
send
(
"
IM A SINK
"
);
});
round_robin
=
0
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment