Skip to content

Commit

Permalink
test: add debug log
Browse files Browse the repository at this point in the history
  • Loading branch information
m90 committed Oct 30, 2023
1 parent 5b4c74b commit 5b34f9e
Show file tree
Hide file tree
Showing 3 changed files with 50 additions and 36 deletions.
10 changes: 9 additions & 1 deletion .github/workflows/docker.test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,15 @@ jobs:
max_attempts: 100
retry_wait_seconds: 2
warning_on_retry: false
command: if (($(docker-compose ${{ env.COMPOSE_ARGS }} logs wdqs-updater | grep "org.wikidata.query.rdf.tool.Updater - Polled" | wc -l) >= 10)); then exit 0; else exit 1; fi
command: |
docker-compose ${{ env.COMPOSE_ARGS }} logs wdqs-updater
line_count=$(docker-compose ${{ env.COMPOSE_ARGS }} logs wdqs-updater | grep "org.wikidata.query.rdf.tool.Updater - Polled" | wc -l)
echo "line count: $line_count"
if [ $line_count -gt 10 ]; then
exit 0;
else
exit 1;
fi
- name: Make a sparql request
run: |
NUM_BINDINGS=$(curl 'http://localhost:9999/bigdata/namespace/wdq/sparql' -H 'Accept: application/sparql-results+json' --data-raw 'query=SELECT+*+WHERE%7B+%3Fs+%3Fp+%3Fo+%7D' | jq '.results.bindings | length')
Expand Down
6 changes: 3 additions & 3 deletions docker-compose.ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,9 @@ services:
environment:
- WBSTACK_WIKIBASE_SCHEME=http
- WBSTACK_LOOP_LIMIT=100
- WBSTACK_API_ENDPOINT=http://api.svc:3030
- WBSTACK_API_ENDPOINT_MARK_FAILED=http://api.svc:3030
- WBSTACK_API_ENDPOINT_MARK_DONE=http://api.svc:3030
- WBSTACK_API_ENDPOINT=http://api.svc:3030/getBatches
- WBSTACK_API_ENDPOINT_MARK_FAILED=http://api.svc:3030/markFailed
- WBSTACK_API_ENDPOINT_MARK_DONE=http://api.svc:3030/markDone
- WBSTACK_BATCH_SLEEP=1
- WIKIBASE_HOST=wikibase.svc
- HEAP_SIZE=32m
70 changes: 38 additions & 32 deletions seeder/server.js
Original file line number Diff line number Diff line change
@@ -1,41 +1,47 @@
var http = require('http');
const wbEdit = require( 'wikibase-edit' )( require( './wikibase-edit.config' ) );
const wbEdit = require('wikibase-edit')(require('./wikibase-edit.config'));

var x = 0
http.createServer(async function (req, res) {
res.writeHead(200, {'Content-Type': 'text/json'});
switch (req.url) {
case '/getBatches':
numEntities = 20;
entities = [];

numEntities = 20;
entities = [];
for (var i=1; i <= numEntities; ++i) {
const { entity } = await wbEdit.entity.create({
type: 'item',
labels: {
'en': new Date().toISOString()
},
descriptions: {
'en': new Date().toDateString() + new Date().toISOString()
}
});

for(var i=1; i <= numEntities; ++i){
const { entity } = await wbEdit.entity.create({
type: 'item',
labels: {
'en': new Date().toISOString()
},
descriptions: {
'en': new Date().toDateString() + new Date().toISOString()
}
});

console.log('created item id', entity.id)
entities.push(entity.id)
}
console.log('created item id', entity.id)
entities.push(entity.id)
}

x += numEntities;
console.log(new Date().toISOString());
console.log(new Date().toISOString());

responseObject = {
'entityIds': entities.join(','),
'wiki': {
'domain': process.env.API_WIKIBASE_DOMAIN,
'wiki_queryservice_namespace': {
'backend': process.env.API_WDQS_BACKEND,
'namespace': 'wdq'
}
},
responseObject = {
'entityIds': entities.join(','),
'wiki': {
'domain': process.env.API_WIKIBASE_DOMAIN,
'wiki_queryservice_namespace': {
'backend': process.env.API_WDQS_BACKEND,
'namespace': 'wdq'
}
},

};
res.end(JSON.stringify([responseObject]));
};
res.end(JSON.stringify([responseObject]));
case '/markFailed':
case '/markDone':
res.writeHead(200);
res.end('1');
default:
res.writeHead(404);
res.end('Not found');
}
}).listen(3030);

0 comments on commit 5b34f9e

Please sign in to comment.