feat(deploy): acquire verified asset bundles before native serving

This commit is contained in:
Pavlo Ratushnyi
2026-10-04 18:05:29 +02:00
parent 4a35883002
commit 12509de281
8 changed files with 454 additions and 1 deletions
+2
View File
@@ -99,6 +99,8 @@ jobs:
sha256sum strata-next-linux-x86_64-musl BUILD-PROVENANCE.txt ELF-AUDIT.txt > SHA256SUMS
- name: Static CLI model smoke
run: python3 scripts/smoke-static-cli.py control-plane/target/x86_64-unknown-linux-musl/release/strata-next
- name: Atomic pinned assets before native serving
run: python3 scripts/smoke-asset-bootstrap.py control-plane/target/x86_64-unknown-linux-musl/release/strata-next
- name: Native systemd unit syntax and path safety
run: python3 scripts/smoke-service-unit.py control-plane/target/x86_64-unknown-linux-musl/release/strata-next
- name: Native deployment configuration without worker launch
+141
View File
@@ -0,0 +1,141 @@
//! Immutable, manifest-pinned assets acquired before native serving starts.
use std::{
error::Error,
fs::{self, File, OpenOptions},
io,
path::{Component, Path, PathBuf},
};
use serde::Deserialize;
use crate::model;
type Result<T> = std::result::Result<T, Box<dyn Error>>;
#[derive(Deserialize)]
#[serde(deny_unknown_fields)]
pub struct AssetBundle {
pub manifest: PathBuf,
pub directory: PathBuf,
}
pub fn validate(bundles: &[AssetBundle]) -> Result<()> {
if bundles.len() > 16 {
return Err("at most 16 asset bundles may be configured".into());
}
for (index, bundle) in bundles.iter().enumerate() {
for path in [&bundle.manifest, &bundle.directory] {
if !path.is_absolute()
|| path.file_name().is_none()
|| path
.components()
.any(|part| matches!(part, Component::ParentDir))
{
return Err("asset paths must be absolute, non-root paths without '..'".into());
}
}
if bundles[..index].iter().any(|other| {
other.directory.starts_with(&bundle.directory)
|| bundle.directory.starts_with(&other.directory)
}) {
return Err("asset bundle destinations must not overlap".into());
}
}
Ok(())
}
/// Parse every manifest before mutation. Each destination is an immutable
/// versioned bundle: a mismatch is an error, never an implicit replacement.
pub async fn provision(bundles: &[AssetBundle]) -> Result<()> {
validate(bundles)?;
let mut manifests = Vec::with_capacity(bundles.len());
for bundle in bundles {
manifests.push(model::Manifest::load(&bundle.manifest).await?);
}
for (bundle, manifest) in bundles.iter().zip(manifests) {
ensure(bundle, &manifest).await?;
}
Ok(())
}
async fn ensure(bundle: &AssetBundle, manifest: &model::Manifest) -> Result<()> {
let parent = bundle
.directory
.parent()
.ok_or("asset directory has no parent")?;
fs::create_dir_all(parent)?;
let name = bundle
.directory
.file_name()
.ok_or("asset directory has no name")?;
let sibling = |suffix: &str| {
let mut value = std::ffi::OsString::from(".");
value.push(name);
value.push(suffix);
parent.join(value)
};
// Keep the lock inode after releasing it: unlinking could let two later
// preparers lock different inodes for the same destination. OS locks are
// released on process death, allowing interrupted downloads to resume.
let mut options = OpenOptions::new();
options.read(true).write(true).create(true).truncate(false);
#[cfg(unix)]
{
use std::os::unix::fs::OpenOptionsExt;
options.mode(0o600).custom_flags(libc::O_NOFOLLOW);
}
let lock = options.open(sibling(".strata-lock"))?;
if !lock.metadata()?.is_file() {
return Err("asset lock must be a regular file".into());
}
lock.try_lock().map_err(
|_| "asset bundle is busy or cannot be locked; retry after preparation finishes",
)?;
if directory_exists(&bundle.directory)? {
return verify_bundle(manifest, &bundle.directory).await;
}
let stage = sibling(".strata-stage");
if !directory_exists(&stage)? {
let mut builder = fs::DirBuilder::new();
#[cfg(unix)]
{
use std::os::unix::fs::DirBuilderExt;
builder.mode(0o700);
}
builder.create(&stage)?;
}
// On failure the private stage remains for resumable acquisition. It is
// never used by the worker and never replaces an existing bundle.
model::fetch(manifest, &stage).await?;
verify_bundle(manifest, &stage).await?;
File::open(&stage)?.sync_all()?;
if fs::symlink_metadata(&bundle.directory).is_ok() {
return Err("asset destination appeared during preparation; refusing to replace it".into());
}
fs::rename(&stage, &bundle.directory)?;
File::open(parent)?.sync_all()?;
Ok(())
}
fn directory_exists(path: &Path) -> Result<bool> {
match fs::symlink_metadata(path) {
Ok(metadata) if metadata.is_dir() && !metadata.file_type().is_symlink() => Ok(true),
Ok(_) => Err("asset destination/stage must be a directory, not a symlink".into()),
Err(error) if error.kind() == io::ErrorKind::NotFound => Ok(false),
Err(error) => Err(error.into()),
}
}
async fn verify_bundle(manifest: &model::Manifest, directory: &Path) -> Result<()> {
// Extra files could come from a different interrupted manifest. Do not
// silently publish a mixed bundle or trust a completion marker alone.
for entry in fs::read_dir(directory)? {
let name = entry?.file_name();
if !manifest.files.iter().any(|file| name == file.name.as_str()) {
return Err(
"asset bundle contains files absent from its manifest; use a new directory".into(),
);
}
}
model::verify(manifest, directory).await
}
+5
View File
@@ -12,6 +12,7 @@ use serde::Deserialize;
use crate::worker::WorkerConfig;
pub struct Config {
pub assets: Vec<crate::asset_bundle::AssetBundle>,
pub shutdown_grace: Duration,
pub max_in_flight_requests: usize,
pub api_key: Option<std::sync::Arc<crate::auth::ApiKey>>,
@@ -24,6 +25,8 @@ pub struct Config {
#[derive(Default, Deserialize)]
#[serde(deny_unknown_fields)]
struct FileConfig {
#[serde(default)]
assets: Vec<crate::asset_bundle::AssetBundle>,
shutdown_grace_s: Option<u64>,
max_in_flight_requests: Option<usize>,
api_key_file: Option<PathBuf>,
@@ -62,6 +65,7 @@ impl Config {
None => FileConfig::default(),
};
crate::asset_bundle::validate(&file.assets)?;
let bind: SocketAddr = optional_env("STRATA_BIND")?
.or(file.bind)
.unwrap_or_else(|| "127.0.0.1:8081".to_owned())
@@ -167,6 +171,7 @@ impl Config {
.map(|path| crate::auth::ApiKey::from_file(&path).map(std::sync::Arc::new))
.transpose()?;
Ok(Self {
assets: file.assets,
shutdown_grace: Duration::from_secs(shutdown_grace_s),
max_in_flight_requests,
api_key,
+1
View File
@@ -1,4 +1,5 @@
pub mod app;
pub mod asset_bundle;
pub mod auth;
pub mod config;
pub mod derived_iq3;
+8 -1
View File
@@ -12,6 +12,12 @@ use strata_control::{
async fn main() -> Result<(), Box<dyn std::error::Error>> {
let args: Vec<String> = env::args().skip(1).collect();
match args.as_slice() {
[command, flag, path] if command == "provision" && flag == "--config" => {
let config = Config::load_with_path(Some(Path::new(path)))?;
strata_control::asset_bundle::provision(&config.assets).await?;
println!("{}", serde_json::json!({"assets_verified": config.assets.len(), "worker_started": false}));
Ok(())
}
[command] if command == "check-config" => {
println!("{}", strata_control::preflight::check(None)?);
Ok(())
@@ -725,7 +731,7 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {
print!("{}", include_str!("../third_party/ggml/LICENSE"));
Ok(())
}
_ => Err("usage: strata-next [serve [--config FILE]|check-config [--config FILE]|service-unit --config ABSOLUTE_FILE --working-dir ABSOLUTE_DIR [--env-file ABSOLUTE_FILE]|doctor|engine-info|engine-help|--ggml-license|model smoke-fixture --output FILE.kar|model fetch MANIFEST --output DIR|model verify MANIFEST --output DIR|model ensure-sharded-preview MANIFEST --source-dir DIR --output FILE.kar --levels N|model ensure-sharded-streamed MANIFEST --source-dir DIR --output FILE.kar --levels N|model ensure-sharded-streamed MANIFEST --source-dir DIR --output FILE.kar --levels N --ple-part-elements E|model export-tensor-f32 FILE.gguf TENSOR --output FILE.f32|model inspect FILE.gguf|model index FILE.gguf [--hash]|model derive-iq3-identity FILE.gguf|model derive-mixed-identity FILE.gguf|model derive-sharded-identity MANIFEST --source-dir DIR|model prepare-f32-preview FILE.gguf --output FILE.kar --levels N|model prepare-iq3-preview FILE.gguf --output FILE.kar --levels N|model prepare-mixed-preview FILE.gguf --output FILE.kar --levels N|model prepare-sharded-preview MANIFEST --source-dir DIR --output FILE.kar --levels N|model prepare-sharded-streamed MANIFEST --source-dir DIR --output FILE.kar --levels N|model prepare-sharded-streamed MANIFEST --source-dir DIR --output FILE.kar --levels N --ple-part-elements E|model inspect-kar FILE.kar|model plan-kar-memory FILE.kar --level N --budget-mib M|model plan-kar-overlay-memory --base BASE.kar --overlay OVERLAY.kar --base-level N --overlay-level N --budget-mib M|model resolve-kar-overlay --base FILE.kar --overlay FILE.kar|model checksum-kar-preview FILE.kar TENSOR LEVEL|model checksum-kar-row FILE.kar TENSOR LEVEL --row ROW_ID|model verify-kar FILE.kar [--manifest SPEC --source-dir DIR]|model verify-iq3-preview FILE.kar --source FILE.gguf|model verify-mixed-preview FILE.kar --source FILE.gguf|model verify-sharded-preview FILE.kar --manifest SPEC --source-dir DIR|model verify-sharded-streamed FILE.kar --manifest SPEC --source-dir DIR --levels N|model verify-sharded-streamed FILE.kar --manifest SPEC --source-dir DIR --levels N --ple-part-elements E|model extract-tokenizer FILE.gguf --output DIR|model tokenize TOKENIZER_DIR TEXT [--special]|model tokenize TOKENIZER_DIR --stdin [--special]|model detokenize TOKENIZER_DIR IDS]".into()),
_ => Err("usage: strata-next [serve [--config FILE]|provision --config FILE|check-config [--config FILE]|service-unit --config ABSOLUTE_FILE --working-dir ABSOLUTE_DIR [--env-file ABSOLUTE_FILE]|doctor|engine-info|engine-help|--ggml-license|model smoke-fixture --output FILE.kar|model fetch MANIFEST --output DIR|model verify MANIFEST --output DIR|model ensure-sharded-preview MANIFEST --source-dir DIR --output FILE.kar --levels N|model ensure-sharded-streamed MANIFEST --source-dir DIR --output FILE.kar --levels N|model ensure-sharded-streamed MANIFEST --source-dir DIR --output FILE.kar --levels N --ple-part-elements E|model export-tensor-f32 FILE.gguf TENSOR --output FILE.f32|model inspect FILE.gguf|model index FILE.gguf [--hash]|model derive-iq3-identity FILE.gguf|model derive-mixed-identity FILE.gguf|model derive-sharded-identity MANIFEST --source-dir DIR|model prepare-f32-preview FILE.gguf --output FILE.kar --levels N|model prepare-iq3-preview FILE.gguf --output FILE.kar --levels N|model prepare-mixed-preview FILE.gguf --output FILE.kar --levels N|model prepare-sharded-preview MANIFEST --source-dir DIR --output FILE.kar --levels N|model prepare-sharded-streamed MANIFEST --source-dir DIR --output FILE.kar --levels N|model prepare-sharded-streamed MANIFEST --source-dir DIR --output FILE.kar --levels N --ple-part-elements E|model inspect-kar FILE.kar|model plan-kar-memory FILE.kar --level N --budget-mib M|model plan-kar-overlay-memory --base BASE.kar --overlay OVERLAY.kar --base-level N --overlay-level N --budget-mib M|model resolve-kar-overlay --base FILE.kar --overlay FILE.kar|model checksum-kar-preview FILE.kar TENSOR LEVEL|model checksum-kar-row FILE.kar TENSOR LEVEL --row ROW_ID|model verify-kar FILE.kar [--manifest SPEC --source-dir DIR]|model verify-iq3-preview FILE.kar --source FILE.gguf|model verify-mixed-preview FILE.kar --source FILE.gguf|model verify-sharded-preview FILE.kar --manifest SPEC --source-dir DIR|model verify-sharded-streamed FILE.kar --manifest SPEC --source-dir DIR --levels N|model verify-sharded-streamed FILE.kar --manifest SPEC --source-dir DIR --levels N --ple-part-elements E|model extract-tokenizer FILE.gguf --output DIR|model tokenize TOKENIZER_DIR TEXT [--special]|model tokenize TOKENIZER_DIR --stdin [--special]|model detokenize TOKENIZER_DIR IDS]".into()),
}
}
@@ -774,6 +780,7 @@ async fn serve(config_path: Option<&Path>) -> Result<(), Box<dyn std::error::Err
}
None => None,
};
strata_control::asset_bundle::provision(&config.assets).await?;
let listener = tokio::net::TcpListener::bind(config.bind).await?;
let mut state = app::AppState {
lifecycle: strata_control::lifecycle::Lifecycle::new(config.max_in_flight_requests)?,
+2
View File
@@ -45,6 +45,8 @@ pub fn check(path: Option<&Path>) -> Result<serde_json::Value, &'static str> {
"tokenizer_validated": config.tokenizer_dir.is_some(),
"inference_configured": config.worker.is_some() && config.tokenizer_dir.is_some(),
"readiness_checked": false,
"asset_bundles_configured": config.assets.len(),
"assets_verified": false,
}))
}
+68
View File
@@ -403,3 +403,71 @@ The optional `static_cuda_package` workflow-dispatch job performs the build and
ELF audit on the private CUDA runner without inference. It publishes no package
and cleans its private build directory. The runner must have the required
compiler/toolkit in its environment; hosted execution has not yet occurred.
## Fetch pinned assets as part of native startup
`serve --config /absolute/runtime.json` can now acquire prebuilt model-pack and
Qwen tokenizer files before it opens its HTTP listener or starts the worker.
Declare an optional `assets` array alongside the existing engine configuration:
```json
{
"assets": [
{
"manifest": "/home/user/strata/pack-v1.manifest.json",
"directory": "/home/user/strata/assets/pack-v1"
},
{
"manifest": "/home/user/strata/tokenizer-v1.manifest.json",
"directory": "/home/user/strata/assets/tokenizer-v1"
}
],
"engine": {
"executable": "@embedded",
"args": ["--pack", "/home/user/strata/assets/pack-v1"],
"tokenizer_dir": "/home/user/strata/assets/tokenizer-v1"
}
}
```
Each local manifest uses the same schema as `model fetch`: `schema_version: 1`
and a nonempty `files` array with `name`, HTTPS `url`, positive `size` and
`sha256` for each file. Names are flat, unique filenames. Use manifests for
artifacts already prepared for the chosen worker; fetching GGUF shards alone
is not a Strata pack conversion. Models and private manifests stay outside Git.
The example requires a Linux executable built with an embedded engine.
To acquire/verify the assets separately without starting the service:
```sh
strata-next provision --config /absolute/runtime.json
```
Paths must be absolute, without `..`; bundle destinations cannot overlap.
All manifests are parsed before acquisition. Each bundle is downloaded into a
private sibling `.NAME.strata-stage`, verified in full, and then published by
a directory rename. Existing bundles are verified even when offline; a digest
mismatch fails without overwriting them. Use a new versioned destination for
upgrades, and retain the previous config/destination for rollback. No global
current-model pointer or running service is changed by provisioning.
A per-destination `.NAME.strata-lock` coordinates native preparers. A competing
preparer fails promptly; process death releases the OS lock. The small lock
file remains to avoid an inode race. Failed/interrupted stages remain for
resume; after stopping all preparers they may be removed to discard incomplete
downloads. Extra files from a different manifest fail verification. Atomicity
is per bundle: if a later bundle fails, earlier verified bundles remain, but
`serve` never launches the worker. Use user-owned local storage for locks and
staging. This is not a defense against another process with the same user's
write access altering files after verification.
`check-config` stays read-only and reports the bundle count and
`assets_verified: false`; it does not download or hash model files. It still
requires configured tokenizer assets to exist. Run `provision` first when
using that preflight on a fresh installation.
This implements acquisition of prepared assets, not automatic GGUF-to-pack
conversion or full KAR model preparation. The complete-package Linux/GPU
clean-node acceptance gate remains separate. The CPU smoke uses synthetic
pack bytes and tokenizer files; it proves publication and startup ordering,
not model inference or performance.
+227
View File
@@ -0,0 +1,227 @@
#!/usr/bin/env python3
"""CPU-only asset acquisition/atomic publication and native serve ordering."""
import hashlib
import importlib.util
import http.client
import http.server
import json
import os
from pathlib import Path
import socket
import subprocess
import sys
import tempfile
import threading
import time
def main():
binary = str(Path(sys.argv[1]).resolve())
payloads = {'weights.pack': b'synthetic pinned pack', 'metadata.json': b'{}\n'}
requests = []
slow_entered, slow_release = threading.Event(), threading.Event()
class Source(http.server.BaseHTTPRequestHandler):
def log_message(self, *_):
pass
def do_GET(self):
name = self.path.lstrip('/')
requests.append(name)
if name == 'slow':
slow_entered.set()
slow_release.wait(15)
name = 'weights.pack'
data = payloads[name]
self.send_response(200)
self.send_header('Content-Length', str(len(data)))
self.end_headers()
try:
self.wfile.write(data)
except (BrokenPipeError, ConnectionResetError):
pass
with tempfile.TemporaryDirectory(prefix='strata-asset-bootstrap-') as tmp:
root = Path(tmp).resolve()
spec = importlib.util.spec_from_file_location('fixture', Path(__file__).with_name('smoke-worker-cancel.py'))
fixture = importlib.util.module_from_spec(spec)
spec.loader.exec_module(fixture)
tokenizer_source = root / 'tokenizer-source'
tokenizer_source.mkdir()
fixture.tokenizer(tokenizer_source)
tokenizer_config = json.loads((tokenizer_source / 'tokenizer.json').read_text())
tokenizer_config['n_merges'] = 1
(tokenizer_source / 'tokenizer.json').write_text(json.dumps(tokenizer_config))
(tokenizer_source / 'merges.txt').write_text('a b')
payloads.update({p.name: p.read_bytes() for p in tokenizer_source.iterdir()})
server = http.server.ThreadingHTTPServer(('127.0.0.1', 0), Source)
thread = threading.Thread(target=server.serve_forever, daemon=True)
thread.start()
processes = []
source = f'http://127.0.0.1:{server.server_port}'
manifest = {'schema_version': 1, 'files': [
{'name': name, 'url': source + '/' + name, 'size': len(data),
'sha256': hashlib.sha256(data).hexdigest()} for name, data in payloads.items()]}
manifest_path = root / 'manifest.json'
manifest_path.write_text(json.dumps(manifest))
destination = root / 'version-one'
config_path = root / 'config.json'
marker = root / 'worker-started'
worker = root / 'worker.sh'
worker.write_text('''#!/bin/sh
set -eu
# Supervisor adds --serve as argument one.
[ "$(cat "$2/weights.pack")" = 'synthetic pinned pack' ]
[ "$(cat "$2/metadata.json")" = '{}' ]
: > "$3"
printf 'READY 256 stop\n'
while IFS= read -r line; do
case "$line" in QUIT) exit 0 ;; esac
done
''')
worker.chmod(0o700)
with socket.socket() as probe:
probe.bind(('127.0.0.1', 0))
port = probe.getsockname()[1]
config = {'bind': f'127.0.0.1:{port}', 'assets': [
{'manifest': str(manifest_path), 'directory': str(destination)}],
'engine': {'executable': str(worker), 'args': [str(destination), str(marker)],
'startup_timeout_s': 5, 'max_restarts': 0}}
env = {'PATH': os.defpath}
count = 0
def save():
config_path.write_text(json.dumps(config))
def run(command='provision', ok=True):
nonlocal count
save()
r = subprocess.run([binary, command, '--config', str(config_path)], env=env,
capture_output=True, text=True, timeout=15)
assert (r.returncode == 0) == ok, (r.stdout, r.stderr)
count += 1
return r
def spawn(command):
save()
log = open(root / f'process-{len(processes)}.log', 'w+')
p = subprocess.Popen([binary, command, '--config', str(config_path)], env=env,
stdout=log, stderr=log)
processes.append((p, log))
return p
def stop(p):
if p.poll() is None:
p.terminate()
p.wait(timeout=8)
try:
# A malformed later manifest must reject before the first download.
bad = root / 'bad.json'
bad.write_text('{}')
config['assets'].append({'manifest': str(bad), 'directory': str(root / 'other')})
run(ok=False)
assert not requests and not destination.exists()
config['assets'].pop()
report = json.loads(run('check-config').stdout)
assert report['asset_bundles_configured'] == 1 and not report['assets_verified']
assert not requests and not destination.exists() and not marker.exists()
# A bad second file cannot publish even the valid first file.
config['engine']['tokenizer_dir'] = str(destination)
manifest['files'][1]['sha256'] = '0' * 64
manifest_path.write_text(json.dumps(manifest))
run('serve', ok=False)
assert not destination.exists() and not marker.exists()
with socket.socket() as check:
check.bind(('127.0.0.1', port))
manifest['files'][1]['sha256'] = hashlib.sha256(payloads['metadata.json']).hexdigest()
manifest_path.write_text(json.dumps(manifest))
p = spawn('serve')
deadline = time.monotonic() + 10
while time.monotonic() < deadline:
if p.poll() is not None:
raise AssertionError('serve exited before readiness')
try:
conn = http.client.HTTPConnection('127.0.0.1', port, timeout=1)
conn.request('GET', '/ready')
r = conn.getresponse()
r.read()
if r.status == 200:
break
except OSError:
pass
finally:
conn.close()
time.sleep(.02)
else:
raise AssertionError('worker never ready')
assert marker.exists()
for name, data in payloads.items():
assert (destination / name).read_bytes() == data
stop(p)
count += 1
# Preserve published data on mismatch; never replace in place.
manifest['files'][0]['sha256'] = '0' * 64
manifest_path.write_text(json.dumps(manifest))
before = len(requests)
run(ok=False)
assert len(requests) == before
assert (destination / 'weights.pack').read_bytes() == payloads['weights.pack']
manifest['files'][0]['sha256'] = hashlib.sha256(payloads['weights.pack']).hexdigest()
manifest_path.write_text(json.dumps(manifest))
# A process death releases the lock; an interrupted stage is reusable.
config['assets'][0]['directory'] = str(root / 'version-two')
manifest['files'][0]['url'] = source + '/slow'
manifest_path.write_text(json.dumps(manifest))
p = spawn('provision')
assert slow_entered.wait(5)
assert 'busy' in run(ok=False).stderr # competing preparer cannot enter the stage
assert not (root / 'version-two').exists()
p.kill()
p.wait(timeout=5)
slow_release.set()
run()
assert (root / 'version-two' / 'weights.pack').read_bytes() == payloads['weights.pack']
# Reject symlinks and overlapping destinations, without writes.
alias = root / 'alias'
alias.symlink_to(destination, target_is_directory=True)
config['assets'][0]['directory'] = str(alias)
run(ok=False)
config['assets'][0]['directory'] = str(destination)
config['assets'].append({'manifest': str(manifest_path), 'directory': str(destination / 'child')})
run(ok=False)
config['assets'].pop()
config['assets'][0]['directory'] = '../escape'
run(ok=False)
config['assets'][0]['directory'] = str(destination)
# Once published, no network is needed, but bytes are still checked.
server.shutdown()
server.server_close()
thread.join(timeout=5)
assert json.loads(run().stdout) == {'assets_verified': 1, 'worker_started': False}
corrupt = b'x' * len(payloads['weights.pack'])
(destination / 'weights.pack').write_bytes(corrupt)
run(ok=False)
assert (destination / 'weights.pack').read_bytes() == corrupt
print(json.dumps({'status': 'passed', 'scenarios': count,
'real_model': False, 'gpu_used': False}))
finally:
slow_release.set()
for p, log in processes:
stop(p)
if p.returncode not in (0, -9, -15):
log.seek(0)
print(log.read(), file=sys.stderr)
log.close()
server.shutdown()
server.server_close()
thread.join(timeout=5)
if __name__ == '__main__':
main()