Skip to content

Commit 13e9198

Browse files
committed
if the request contains a metadata field, save it
1 parent d135606 commit 13e9198

File tree

2 files changed

+9
-2
lines changed

2 files changed

+9
-2
lines changed

conjure-aas.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,10 @@ function submitHandler(req, res) {
3939
// create directory
4040
fs.mkdirSync(`conjure-output/${thisJobId}`, { recursive: true });
4141

42+
if (req.body.metadata !== undefined && req.body.metadata !== "") {
43+
fs.writeFileSync(`conjure-output/${thisJobId}/metadata.json`, req.body.metadata);
44+
}
45+
4246
// we cache the essence + eprime in a model-cache to avoid rerunning conjure-modelling
4347
let cacheKey = md5(req.body.model.trim());
4448
let cacheHit = false;

static/client.js

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,13 +30,15 @@ class ConjureClient {
3030
solve(model, params={}) {
3131
const solver = params.solver || "kissat";
3232
const options = params.options || [];
33+
const metadata = params.metadata || "";
34+
const metadata_str = typeof metadata === "string" ? metadata : JSON.stringify(metadata);
3335
const data = params.data || {};
3436
const data_str = typeof data === "string" ? data : JSON.stringify(data);
35-
return this._submit(model, data_str, solver, options)
37+
return this._submit(model, data_str, solver, options, metadata_str)
3638
.then(jobid => this._get(jobid));
3739
}
3840

39-
_submit(model, data_str, solver, options) {
41+
_submit(model, data_str, solver, options, metadata) {
4042
return new Promise((resolve, reject) => {
4143
fetch(`${this.domain}/submit`, {
4244
method: 'POST', headers: {
@@ -47,6 +49,7 @@ class ConjureClient {
4749
model,
4850
data: data_str,
4951
conjureOptions: options,
52+
metadata: metadata
5053
})
5154
})
5255
.then(response => response.json())

0 commit comments

Comments
 (0)