mirror of https://github.com/percyliang/sempre
sanbox updates
This commit is contained in:
parent
5b706edc4e
commit
306ec6f65b
2
run
2
run
|
|
@ -1078,7 +1078,7 @@ addMode('int-utils', 'small commands like run community server, backup, or simul
|
|||
'local' => o('serverURL', 'http://localhost:8410'),
|
||||
'remote' => o('serverURL', 'http://jonsson.stanford.edu:8410')
|
||||
}),
|
||||
o('logToFile', 0), # set to anything else to log stuff
|
||||
o('sandbox', 1), # set to 0 to enable logging
|
||||
nil),
|
||||
}),
|
||||
nil) })
|
||||
|
|
|
|||
|
|
@ -1,4 +1,12 @@
|
|||
|
||||
Experimental work following
|
||||
1) ./shrdlurn/runServer.sh to start both servers
|
||||
2) Blast the server with simulator on previous logs, under sandbox mode, to get the server into state
|
||||
3) Collect and append to more logs
|
||||
4) For any particular experiment, save the previous log
|
||||
- ./run @mode=int-utils @cmd=backup-mv
|
||||
- reset the log
|
||||
potentially reset citation and grammar information as well?
|
||||
5) blast server with non-sandbox call to get previous citations
|
||||
|
||||
Default port: 8410 for sempre, 8406 for user
|
||||
Run: ./run @mode=interactive -Server.port 8410
|
||||
|
|
|
|||
|
|
@ -195,9 +195,9 @@ public class JsonServer {
|
|||
|
||||
void handleQuery(String sessionId) throws IOException {
|
||||
String query = reqParams.get("q");
|
||||
boolean logToFile = true; // false when simulating
|
||||
if (reqParams.containsKey("logtofile") && reqParams.get("logtofile").equals("0"))
|
||||
logToFile = false;
|
||||
boolean sandbox = false; // false when simulating
|
||||
if (reqParams.containsKey("sandbox") && !reqParams.get("sandbox").equals("0"))
|
||||
sandbox = true;
|
||||
|
||||
String queryTime = LocalDateTime.now().toString();
|
||||
{ // write the query log
|
||||
|
|
@ -208,9 +208,11 @@ public class JsonServer {
|
|||
// jsonMap.putAll(reqParams);
|
||||
jsonMap.put("remote", remoteHost);
|
||||
|
||||
boolean isContext = query.startsWith("(:context ");
|
||||
|
||||
|
||||
synchronized (queryLogLock) {
|
||||
if (logToFile && (!isContext || opts.verbose >= 2)) {
|
||||
boolean isContext = query.startsWith("(:context ");
|
||||
if (!sandbox && (!isContext || opts.verbose >= 2)) {
|
||||
PrintWriter out = IOUtils.openOutAppend(opts.queryLogPath);
|
||||
out.println(Json.writeValueAsStringHard(jsonMap));
|
||||
out.close();
|
||||
|
|
@ -225,7 +227,7 @@ public class JsonServer {
|
|||
session.remoteHost = remoteHost;
|
||||
session.format = "json";
|
||||
//
|
||||
session.logToFile = logToFile;
|
||||
session.logToFile = sandbox;
|
||||
|
||||
if (query == null) query = session.getLastQuery();
|
||||
if (query == null) query = "";
|
||||
|
|
@ -258,7 +260,7 @@ public class JsonServer {
|
|||
jsonMap.put("q", query); // backwards compatability...
|
||||
jsonMap.put("lines", responseMap.get("lines"));
|
||||
synchronized (responseLogLock) {
|
||||
if (logToFile) {
|
||||
if (!sandbox) {
|
||||
{
|
||||
PrintWriter out = IOUtils.openOutAppend(opts.responseLogPath);
|
||||
out.println(Json.writeValueAsStringHard(jsonMap));
|
||||
|
|
|
|||
|
|
@ -484,7 +484,7 @@ public class Master {
|
|||
if (match != null) {
|
||||
LogInfo.logs("Matched: %s", match);
|
||||
|
||||
if (session.logToFile) {
|
||||
if (!session.sandbox) {
|
||||
CitationTracker tracker = new CitationTracker(session.id, ex);
|
||||
tracker.citeAll(match);
|
||||
}
|
||||
|
|
@ -512,7 +512,7 @@ public class Master {
|
|||
response.ex = refExHead.value;
|
||||
|
||||
// write out the grammar
|
||||
if (session.logToFile) {
|
||||
if (!session.sandbox) {
|
||||
PrintWriter out = IOUtils.openOutAppendHard(Paths.get(Master.opts.newGrammarPath, session.id + ".grammar").toString());
|
||||
for (Rule rule : inducedRules) {
|
||||
out.println(rule.toLispTree().toStringWrap());
|
||||
|
|
|
|||
|
|
@ -29,7 +29,7 @@ public class Session {
|
|||
Example lastEx; // Last example that we processed
|
||||
Params params;
|
||||
Learner learner;
|
||||
boolean logToFile = true;
|
||||
boolean sandbox = false;
|
||||
|
||||
public static Options opts = new Options();
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue