@zilliz/milvus2-sdk-node 2.5.11 → 2.6.0-rc1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/milvus/MilvusClient.js +2 -2
- package/dist/milvus/MilvusClient.js.map +1 -1
- package/dist/milvus/const/milvus.d.ts +4 -2
- package/dist/milvus/const/milvus.js +4 -0
- package/dist/milvus/const/milvus.js.map +1 -1
- package/dist/milvus/grpc/Collection.d.ts +63 -1
- package/dist/milvus/grpc/Collection.js +89 -0
- package/dist/milvus/grpc/Collection.js.map +1 -1
- package/dist/milvus/grpc/Data.js +6 -0
- package/dist/milvus/grpc/Data.js.map +1 -1
- package/dist/milvus/index.d.ts +0 -1
- package/dist/milvus/index.js +0 -1
- package/dist/milvus/index.js.map +1 -1
- package/dist/milvus/proto-json/milvus.base.d.ts +129 -0
- package/dist/milvus/proto-json/milvus.base.js +143 -11
- package/dist/milvus/proto-json/milvus.base.js.map +1 -1
- package/dist/milvus/proto-json/milvus.d.ts +129 -0
- package/dist/milvus/proto-json/milvus.js +143 -11
- package/dist/milvus/proto-json/milvus.js.map +1 -1
- package/dist/milvus/proto-json/schema.base.d.ts +88 -0
- package/dist/milvus/proto-json/schema.base.js +97 -6
- package/dist/milvus/proto-json/schema.base.js.map +1 -1
- package/dist/milvus/types/Collection.d.ts +10 -0
- package/dist/milvus/types/Data.d.ts +3 -1
- package/dist/milvus/utils/Bytes.d.ts +13 -1
- package/dist/milvus/utils/Bytes.js +34 -1
- package/dist/milvus/utils/Bytes.js.map +1 -1
- package/dist/milvus/utils/Format.d.ts +15 -0
- package/dist/milvus/utils/Format.js +49 -24
- package/dist/milvus/utils/Format.js.map +1 -1
- package/dist/milvus/utils/Function.js +3 -0
- package/dist/milvus/utils/Function.js.map +1 -1
- package/dist/milvus/utils/Validate.js +2 -1
- package/dist/milvus/utils/Validate.js.map +1 -1
- package/dist/sdk.json +1 -1
- package/package.json +4 -6
- package/dist/milvus/MilvusLiteClient.d.ts +0 -5
- package/dist/milvus/MilvusLiteClient.js +0 -40
- package/dist/milvus/MilvusLiteClient.js.map +0 -1
- package/dist/milvus/lite/MilvusLiteServer.d.ts +0 -11
- package/dist/milvus/lite/MilvusLiteServer.js +0 -201
- package/dist/milvus/lite/MilvusLiteServer.js.map +0 -1
- package/dist/milvus/lite/start.py +0 -66
|
@@ -1,201 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
-
}) : function(o, v) {
|
|
16
|
-
o["default"] = v;
|
|
17
|
-
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
-
if (mod && mod.__esModule) return mod;
|
|
20
|
-
var result = {};
|
|
21
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
-
__setModuleDefault(result, mod);
|
|
23
|
-
return result;
|
|
24
|
-
};
|
|
25
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
26
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
27
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
28
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
29
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
30
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
31
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
32
|
-
});
|
|
33
|
-
};
|
|
34
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
35
|
-
exports.startMilvusLiteServer = void 0;
|
|
36
|
-
/* istanbul ignore file */
|
|
37
|
-
const child_process_1 = require("child_process");
|
|
38
|
-
const path = __importStar(require("path"));
|
|
39
|
-
const logger_1 = require("../utils/logger"); // Assuming logger is correctly set up
|
|
40
|
-
function startMilvusLiteServer(options = {}) {
|
|
41
|
-
const dataPath = options.dataPath || ''; // Python script defaults to 'test.db' if this is empty
|
|
42
|
-
const pythonCmd = process.platform === 'win32' ? 'python' : 'python3';
|
|
43
|
-
// Ensure logger level is set if provided
|
|
44
|
-
if (options.logLevel) {
|
|
45
|
-
logger_1.logger.level = options.logLevel;
|
|
46
|
-
}
|
|
47
|
-
else {
|
|
48
|
-
// Default logger level if not set (optional, depends on your logger's default)
|
|
49
|
-
// logger.level = 'info';
|
|
50
|
-
}
|
|
51
|
-
return new Promise((resolve, reject) => {
|
|
52
|
-
var _a, _b, _c;
|
|
53
|
-
const startPy = path.join(__dirname, 'start.py'); // Ensure 'start.py' is in the same directory or adjust path
|
|
54
|
-
logger_1.logger.debug(`Starting Milvus Lite server with python script: ${startPy} using ${pythonCmd}`);
|
|
55
|
-
if (dataPath) {
|
|
56
|
-
logger_1.logger.debug(`Data path for Milvus Lite: ${dataPath}`);
|
|
57
|
-
}
|
|
58
|
-
else {
|
|
59
|
-
logger_1.logger.debug(`No data path specified, Milvus Lite will use its default.`);
|
|
60
|
-
}
|
|
61
|
-
const childProcess = (0, child_process_1.spawn)(pythonCmd, ['-u', startPy, dataPath], {
|
|
62
|
-
// stdio: ['pipe', 'pipe', 'pipe'] // Default, but can be explicit
|
|
63
|
-
});
|
|
64
|
-
let promiseSettled = false;
|
|
65
|
-
const settlePromise = (settler) => {
|
|
66
|
-
if (!promiseSettled) {
|
|
67
|
-
promiseSettled = true;
|
|
68
|
-
settler();
|
|
69
|
-
}
|
|
70
|
-
};
|
|
71
|
-
// Graceful shutdown signal handling for the parent Node.js process
|
|
72
|
-
const signalHandler = (signal) => {
|
|
73
|
-
logger_1.logger.debug(`${signal} received for parent process, attempting to stop Milvus Lite server.`);
|
|
74
|
-
if (childProcess && !childProcess.killed) {
|
|
75
|
-
childProcess.kill(signal === 'SIGINT' ? 'SIGINT' : 'SIGTERM'); // Forward the signal
|
|
76
|
-
}
|
|
77
|
-
// process.exit(); // Exiting the parent process should be handled by the caller or signal default behavior
|
|
78
|
-
};
|
|
79
|
-
process.on('SIGINT', () => signalHandler('SIGINT'));
|
|
80
|
-
process.on('SIGTERM', () => signalHandler('SIGTERM'));
|
|
81
|
-
// The 'exit' handler for the parent process might be too late or might not run for all exit types.
|
|
82
|
-
// It's generally better to ensure resources are cleaned up on signals or before explicit exit.
|
|
83
|
-
process.on('exit', () => {
|
|
84
|
-
if (childProcess && !childProcess.killed) {
|
|
85
|
-
logger_1.logger.debug('Node.js process exiting, ensuring Milvus Lite server process is killed.');
|
|
86
|
-
childProcess.kill(); // Default SIGTERM
|
|
87
|
-
}
|
|
88
|
-
});
|
|
89
|
-
childProcess.on('error', (err) => {
|
|
90
|
-
logger_1.logger.error(`Error starting Milvus Lite server: ${err}`);
|
|
91
|
-
reject(err);
|
|
92
|
-
});
|
|
93
|
-
(_a = childProcess.stderr) === null || _a === void 0 ? void 0 : _a.on('data', (data) => {
|
|
94
|
-
const message = data.toString();
|
|
95
|
-
logger_1.logger.error(`Milvus Lite server stderr: ${message}`);
|
|
96
|
-
if (message.includes("No module named 'milvus_lite'")) {
|
|
97
|
-
reject(new Error('Milvus Lite is not installed. Please install it using "pip install milvus-lite".'));
|
|
98
|
-
}
|
|
99
|
-
});
|
|
100
|
-
childProcess.on('exit', (code) => {
|
|
101
|
-
logger_1.logger.debug(`Milvus Lite server exited with code: ${code}`);
|
|
102
|
-
if (code !== 0) {
|
|
103
|
-
reject(new Error(`Milvus Lite server exited with code ${code}`));
|
|
104
|
-
}
|
|
105
|
-
});
|
|
106
|
-
(_b = childProcess.stdout) === null || _b === void 0 ? void 0 : _b.on('data', (data) => {
|
|
107
|
-
const messages = data
|
|
108
|
-
.toString()
|
|
109
|
-
.split('\n')
|
|
110
|
-
.filter(msg => msg.trim() !== '');
|
|
111
|
-
messages.forEach(message => {
|
|
112
|
-
logger_1.logger.debug(`Milvus Lite stdout: ${message}`);
|
|
113
|
-
try {
|
|
114
|
-
const parsed = JSON.parse(message);
|
|
115
|
-
if (parsed.error) {
|
|
116
|
-
logger_1.logger.error(`Error from Milvus Lite script: ${parsed.error}`);
|
|
117
|
-
settlePromise(() => reject(new Error(parsed.error)));
|
|
118
|
-
if (childProcess && !childProcess.killed) {
|
|
119
|
-
childProcess.kill(); // Kill the process as it reported a fatal error
|
|
120
|
-
}
|
|
121
|
-
}
|
|
122
|
-
else if (parsed.uri && parsed.version) {
|
|
123
|
-
logger_1.logger.debug(`Milvus Lite server started. URI: ${parsed.uri}, Version: ${parsed.version}`);
|
|
124
|
-
settlePromise(() => resolve({
|
|
125
|
-
uri: parsed.uri,
|
|
126
|
-
version: parsed.version,
|
|
127
|
-
stopServer: () => __awaiter(this, void 0, void 0, function* () {
|
|
128
|
-
return new Promise(resolveStop => {
|
|
129
|
-
if (childProcess && !childProcess.killed) {
|
|
130
|
-
logger_1.logger.debug('StopServer: Sending SIGINT to Milvus Lite server...');
|
|
131
|
-
// Handle stop confirmation
|
|
132
|
-
let stopTimeout = null;
|
|
133
|
-
const onStopExit = (code, signal) => {
|
|
134
|
-
if (stopTimeout)
|
|
135
|
-
clearTimeout(stopTimeout);
|
|
136
|
-
logger_1.logger.debug(`Milvus Lite server process stopped. Code: ${code}, Signal: ${signal}`);
|
|
137
|
-
resolveStop();
|
|
138
|
-
};
|
|
139
|
-
childProcess.once('exit', onStopExit);
|
|
140
|
-
childProcess.kill('SIGINT'); // Python script handles SIGINT to stop server_manager_instance
|
|
141
|
-
// Timeout to force kill if SIGINT doesn't work
|
|
142
|
-
stopTimeout = setTimeout(() => {
|
|
143
|
-
if (childProcess && !childProcess.killed) {
|
|
144
|
-
logger_1.logger.warn('Milvus Lite server did not stop with SIGINT in 5s, sending SIGKILL.');
|
|
145
|
-
childProcess.kill('SIGKILL');
|
|
146
|
-
// Resolve a bit later to allow SIGKILL to process, though 'exit' should still fire
|
|
147
|
-
setTimeout(resolveStop, 200);
|
|
148
|
-
}
|
|
149
|
-
}, 5000);
|
|
150
|
-
}
|
|
151
|
-
else {
|
|
152
|
-
logger_1.logger.debug('StopServer: Milvus Lite server already stopped or not running.');
|
|
153
|
-
resolveStop();
|
|
154
|
-
}
|
|
155
|
-
});
|
|
156
|
-
}),
|
|
157
|
-
}));
|
|
158
|
-
}
|
|
159
|
-
else if (parsed.info) {
|
|
160
|
-
logger_1.logger.info(`Info from Milvus Lite script: ${parsed.info}`);
|
|
161
|
-
}
|
|
162
|
-
// Ignore other JSON messages if any, or add more specific handling
|
|
163
|
-
}
|
|
164
|
-
catch (e) {
|
|
165
|
-
// This means the line was not JSON. It might be other debug output from Python.
|
|
166
|
-
logger_1.logger.debug(`Non-JSON stdout from Milvus Lite script: ${message}`);
|
|
167
|
-
}
|
|
168
|
-
});
|
|
169
|
-
});
|
|
170
|
-
(_c = childProcess.stderr) === null || _c === void 0 ? void 0 : _c.on('data', (data) => {
|
|
171
|
-
const errMessage = data.toString().trim();
|
|
172
|
-
logger_1.logger.error(`Milvus Lite stderr: ${errMessage}`);
|
|
173
|
-
// Generally, errors from Python script that cause it to exit will also result in a non-zero exit code.
|
|
174
|
-
// You could choose to reject here if stderr always indicates a fatal error for your script.
|
|
175
|
-
// However, be cautious not to reject twice if stdout or exit handler already does.
|
|
176
|
-
// For now, just logging it. The exit handler will catch failures.
|
|
177
|
-
});
|
|
178
|
-
childProcess.on('exit', (code, signal) => {
|
|
179
|
-
logger_1.logger.debug(`Milvus Lite server process exited with code: ${code}, signal: ${signal}`);
|
|
180
|
-
if (!promiseSettled) {
|
|
181
|
-
// If promise hasn't been resolved (e.g. with URI) or rejected (e.g. by JSON error)
|
|
182
|
-
let exitErrorMsg = 'Milvus Lite server process exited prematurely.';
|
|
183
|
-
if (signal) {
|
|
184
|
-
exitErrorMsg = `Milvus Lite server process was terminated by signal: ${signal}.`;
|
|
185
|
-
}
|
|
186
|
-
else if (code !== null && code !== 0) {
|
|
187
|
-
exitErrorMsg = `Milvus Lite server process exited with error code: ${code}.`;
|
|
188
|
-
}
|
|
189
|
-
else if (code === 0) {
|
|
190
|
-
// Exited cleanly but didn't resolve the promise (e.g. no URI sent)
|
|
191
|
-
exitErrorMsg =
|
|
192
|
-
'Milvus Lite server process exited cleanly but did not report a URI.';
|
|
193
|
-
}
|
|
194
|
-
logger_1.logger.error(exitErrorMsg + ' Check logs for more details.');
|
|
195
|
-
settlePromise(() => reject(new Error(exitErrorMsg)));
|
|
196
|
-
}
|
|
197
|
-
});
|
|
198
|
-
});
|
|
199
|
-
}
|
|
200
|
-
exports.startMilvusLiteServer = startMilvusLiteServer;
|
|
201
|
-
//# sourceMappingURL=MilvusLiteServer.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"MilvusLiteServer.js","sourceRoot":"","sources":["../../../milvus/lite/MilvusLiteServer.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,0BAA0B;AAC1B,iDAAsC;AACtC,2CAA6B;AAC7B,4CAAyC,CAAC,sCAAsC;AAahF,SAAgB,qBAAqB,CACnC,UAAmC,EAAE;IAErC,MAAM,QAAQ,GAAG,OAAO,CAAC,QAAQ,IAAI,EAAE,CAAC,CAAC,uDAAuD;IAChG,MAAM,SAAS,GAAG,OAAO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-
# start_milvus.py
|
|
2
|
-
import json
|
|
3
|
-
import time
|
|
4
|
-
import sys
|
|
5
|
-
import signal
|
|
6
|
-
|
|
7
|
-
try:
|
|
8
|
-
import milvus_lite
|
|
9
|
-
from milvus_lite.server_manager import server_manager_instance
|
|
10
|
-
MILVUS_LITE_VERSION = milvus_lite.__version__
|
|
11
|
-
MILVUS_LITE_INSTALLED = True
|
|
12
|
-
except ImportError:
|
|
13
|
-
MILVUS_LITE_VERSION = "unknown"
|
|
14
|
-
MILVUS_LITE_INSTALLED = False
|
|
15
|
-
# Define a placeholder for server_manager_instance if milvus_lite is not installed
|
|
16
|
-
# to prevent NameError in the finally block or signal handlers if start_milvus is not called.
|
|
17
|
-
class PlaceholderServerManager:
|
|
18
|
-
def release_all(self): # MODIFIED method name
|
|
19
|
-
pass # Do nothing if Milvus Lite was never started
|
|
20
|
-
server_manager_instance = PlaceholderServerManager()
|
|
21
|
-
except Exception as e:
|
|
22
|
-
MILVUS_LITE_VERSION = "unknown"
|
|
23
|
-
MILVUS_LITE_INSTALLED = False
|
|
24
|
-
# Handle other potential exceptions during import
|
|
25
|
-
print(json.dumps({"error": f"An unexpected error occurred during Milvus Lite import: {str(e)}"}), flush=True)
|
|
26
|
-
sys.exit(1)
|
|
27
|
-
|
|
28
|
-
def start_milvus(db_path="test.db"):
|
|
29
|
-
if not MILVUS_LITE_INSTALLED:
|
|
30
|
-
print(json.dumps({"error": "Milvus Lite is not installed. Please install it to continue."}), flush=True)
|
|
31
|
-
sys.exit(1)
|
|
32
|
-
try:
|
|
33
|
-
local_uri = server_manager_instance.start_and_get_uri(db_path)
|
|
34
|
-
if not local_uri:
|
|
35
|
-
print(json.dumps({"error": "Failed to start Milvus Lite."}), flush=True)
|
|
36
|
-
sys.exit(1)
|
|
37
|
-
|
|
38
|
-
print(json.dumps({ "uri": local_uri, "version": MILVUS_LITE_VERSION}), flush=True)
|
|
39
|
-
|
|
40
|
-
while True:
|
|
41
|
-
time.sleep(1)
|
|
42
|
-
except KeyboardInterrupt:
|
|
43
|
-
print(json.dumps({"debug": "Shutting down..."}), flush=True)
|
|
44
|
-
finally:
|
|
45
|
-
if MILVUS_LITE_INSTALLED: # Only try to stop if it was potentially started
|
|
46
|
-
server_manager_instance.release_all() # MODIFIED method call
|
|
47
|
-
|
|
48
|
-
def handle_exit(signum, frame):
|
|
49
|
-
# print a message to stdout so Node.js can see it if needed
|
|
50
|
-
print('{"debug": "Received exit signal, shutting down..."}', flush=True)
|
|
51
|
-
# Instead of server_manager_instance.stop()
|
|
52
|
-
# Call release_all() to properly shut down all server instances
|
|
53
|
-
server_manager_instance.release_all() # MODIFIED LINE
|
|
54
|
-
sys.exit(0) # Or let the script exit naturally after cleanup
|
|
55
|
-
|
|
56
|
-
signal.signal(signal.SIGINT, handle_exit)
|
|
57
|
-
signal.signal(signal.SIGTERM, handle_exit)
|
|
58
|
-
|
|
59
|
-
if __name__ == "__main__":
|
|
60
|
-
if not MILVUS_LITE_INSTALLED:
|
|
61
|
-
print(json.dumps({"error": "Milvus Lite is not installed. Please install it to run this script."}), flush=True)
|
|
62
|
-
sys.exit(1)
|
|
63
|
-
|
|
64
|
-
db_path = sys.argv[1] if len(sys.argv) > 1 else "test.db"
|
|
65
|
-
print(json.dumps({"debug": f"Starting Milvus Lite with DB: {db_path}"}), flush=True)
|
|
66
|
-
start_milvus(db_path)
|