Show HN:用两条命令流式传输实时开放数据
Show HN: Stream live open data in two commands

原始链接: https://docs.hypermass.io/docs/cli/

Hypermass CLI 是一个命令行工具,可将实时 Hypermass 数据流同步到本地文件夹。安装后,使用 `hypermass subscribe ` 配置流,并使用 `hypermass sync` 在文件发布时持续获取文件。文件会出现在 `/hypermass/subscriptions/` 下,每个载荷一个文件,以载荷 ID 命名,并按发布顺序交付。你可以处理并删除数据文件,但必须保留每个流的隐藏 `.hypermass` 文件夹,它用于跟踪你在流中的位置。`sync` 还会从配置的发布源发布文件。使用 `status`、replay 和 `reload` 监控或管理流。该 CLI 面向数据科学家、开发者、研究人员和生产系统,他们需要一种简单、可重复、跨平台的方式来自动化数据摄取和发布。

Show HN:Hypermass 通过两条命令和一个 Apache-2.0 Go CLI 提供实时开放数据流。订阅者无需注册;CLI 监听多个流,并将到达的文件写入本地文件夹,使用 ULID 文件名进行按时间排序。发布者将文件放入文件夹即可上传。它处理排序、重试、哈希验证和重连。示例流包括 SOHO 太阳紫外图像和经过过滤的 GDACS 灾害警报。这位英国独立创始人曾从事铁路开放数据,他构建它是为了实时但低频的数据——这些数据轮询成本太高,且体积太大不适合消息传递。技术细节:WebSocket 通知、签名 CDN 下载、XML/JSON 验证,目前还没有库,但计划提供 API 和 post-payload 回调,以及高速馈送。可持续性:免费层、重度用户配额,之后由机构发布者付费,可能还有一个市场。他问 CLI 是否解决真实问题,这种方法是否合理,以及如何启动发布者。
相关文章

原文

The Hypermass CLI delivers live data from streams to a folder on your machine, in real time as it's published.

1. Install​

See the installation instructions (don't worry, they link back here when you're done).

If you opted just to try it rather than install, remember to type ./hypermass (or hypermass.exe for windows) in the commands below rather than just hypermass.

2. Subscribe and sync​

Try it with a live stream of solar images:

hypermass subscribe _254gGE43g
hypermass sync

Subscribe just updates the configuration. Sync starts the live porcess that fetches data, so leave hypermass sync running. You'll see some messages appear about what sync is doing (you can kill it at any time with ctrl-C).

Files arrive in <home folder>/hypermass/subscriptions/_254gGE43g as they're published, one file per payload. In the above example you should see the most recent image of the sun captured by the SOHO telescope (see: EIT 284a instrument) in the folder.

If you leave hypermass sync running for a day, the next day's images will arrive in the same folder as it is published (typically about 4:15 GMT).

To subscribe to any other stream, the Get live data button on its page at hypermass.io shows the command, ready to copy.

3. Use the data​

Now that files are arriving in your local folder, you can process them and delete them when you are done. The hypermass sync process won't modify that file again, and deleting those files once processed is a good way to keep track of which ones you've handled (don't worry you can always replay the stream messages if you need to).

The hypermass cli keeps track of what files have been fetched, and they always arrive in the published order. Each file is named with its payload id, and sorting the files by name puts them in that same published order. We also update the last modified time of the file to the time the payload was published - but this can be less reliable since opening the file may modify this. If you need reliable timestamps, consider using the folder-with-metadata configuration.

Keep the .hypermass folder

Each stream's folder holds a hidden .hypermass folder. It records which stream the folder belongs to and the last payload received - your place in the stream. Delete only the data files, and leave .hypermass in place: without it, the CLI no longer recognises the folder as the stream's, and your place in the stream is lost.

Next steps​

  • See what else it can do: check every stream's progress with hypermass status, replay a stream from any point in its history, and change your streams on the fly with hypermass reload - Using The CLI
  • Put the data to work in your own code: Building a client
  • Run it on a server: install hypermass sync as a service, so it keeps running across restarts - Download & Install
  • Publish your own data: Publish your own streams

Who is the CLI for?​

We envisage that the Hypermass CLI will be the 'usual' way to automatically synchronise data from Hypermass to your desktop and server, for use with your programs and workflows. If you are a data scientist, developer or researcher it's a convenient and repeatable means of fetching and publishing the data that you need with a single command.

For programs and production environments, it offers a neat, simple method of integrating hypermass data streams into your application.

Why this approach?​

A command line tool allows for automation and also for user operation. It works for many platforms and languages. If you're interested in our thought process in creating the CLI, please see our detailed article CLI Design Rationale.

The "sync" command​

The hypermass sync command is the real magic of the Hypermass cli approach - it both subscribes and publishes. It puts data from Hypermass streams into local folders for you to process however you want, and uploads any files you write to the folders listed under publication-sources in your config.

Once sync is running, you can use the hypermass status command in another terminal to see the current status, file queues and other useful information.

联系我们 contact @ memedata.com