npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

hpss

v0.0.20

Published

hpss interface for nodejs

Downloads

43

Readme

node-hpss

hpss hsi/htar interface for nodejs.

Currently, only hsi command is supported (htar is still TODO).

Installation

npm install hpss

Sample Use

mkdir

Create a directory in HPSS

var fs = require("fs");
var hpss = require("hpss");
var context = new hpss.context({
    username: "hayashis",
    keytab: fs.readFileSync("/home/hayashis/.ssh/soichi-hsi.keytab")
});
context.mkdir('some/path/in/hpss', function(err) {
    if(err) throw err;
});

rmdir

Remove an empty directory in HPSS

context.rmdir('some/path/in/hpss', function(err) {
    if(err) throw err;
});

Trying to remove a non-empty directory (or non-accessible directory) will return err.code: 64. Removing non-existing directory is no-op and results in null err.

touch

context.touch('some/path/in/hpss/filename', function(err) {
    if(err) throw err;
});

rm

Remove a file from HPSS

context.rm('some/path/in/hpss/filename', function(err) {
    if(err) throw err;
});

Trying to remove non-existing will result in err.code:72

ls

context.ls('some/path/in/hpss', function(err, files) {
    console.dir(files);
});

files will contain list of files / directories. I might change the mode / owner / group etc.. into a single fs.Stats object in the future version..

[ { mode:
     { directory: false,
       ur: true,
       uw: true,
       ux: false,
       gr: false,
       gw: false,
       gx: false,
       or: false,
       ow: false,
       ox: false },
    links: 1,
    owner: 'hayashis',
    group: 'hpss',
    cos: '3',
    acct: '740536',
    where: 'DISK',
    size: 7591690240,
    date: Sun May 20 2001 09:07:00 GMT+0000 (UTC),
    entry: 'CentOS-7-x86_64-Everything-1503-01.iso',
    _raw: '-rw-------    1 hayashis  hpss          3       740536 DISK    7591690240 May 20 09:07 isos/CentOS-7-x86_64-Everything-1503-01.iso' },
  { mode:
     { directory: true,
       ur: true,
       uw: true,
       ux: true,
       gr: false,
       gw: false,
       gx: false,
       or: false,
       ow: false,
       ox: false },
    links: 2,
    owner: 'hayashis',
    group: 'hpss',
    cos: '740536',
    size: 512,
    date: Fri Aug 10 2001 20:55:00 GMT+0000 (UTC),
    entry: 'subdir',
    _raw: 'drwx------    2 hayashis  hpss                  740536                512 Aug 10 20:55 isos/subdir' },
  { mode:
     { directory: false,
       ur: true,
       uw: true,
       ux: false,
       gr: false,
       gw: false,
       gx: false,
       or: false,
       ow: false,
       ox: false },
    links: 1,
    owner: 'hayashis',
    group: 'hpss',
    cos: '3',
    acct: '740536',
    where: 'DISK',
    size: 1044381696,
    date: Sun May 20 2001 09:06:00 GMT+0000 (UTC),
    entry: 'ubuntu-14.04.2-desktop-amd64.iso',
    _raw: '-rw-------    1 hayashis  hpss          3       740536 DISK    1044381696 May 20 09:06 isos/ubuntu-14.04.2-desktop-amd64.iso' } ]

See test/test.js for error handling

put

1st argument for hsi.put is the local file path, and 2nd is the remote (hpss) path. It needs to contain the file path (some.tar.gz) on remote path Otherwise hsi will somehow not send any file..

context.put('/usr/local/some.tar.gz', '/hpss/path/some.tar.gz', function(err) {
    if(err) throw err;
}, function(progress) {
    console.dir(progress);
});

You can receive progress report via the 2nd callback function you provide (optional). I've throttled down the frequency of hsi.put progress message to 1 in every 3 seconds (1 second for hsi.get) since hsi.put progress reports requies hsi.ls call on the remote file.

{ progress: 0.4205854166191833,
  total_size: 508599432,
  transferred_size: 213909504,
  elapsed_time: 5251 }
{ progress: 0.8494176061132526,
  total_size: 508599432,
  transferred_size: 432013312,
  elapsed_time: 10274 }
{ progress: 1,
  total_size: 508599432,
  transferred_size: 508599432,
  elapsed_time: 12279 }

See test/test.js for error handling

get

1st argument for hsi.get is the remote hpss path, and 2nd argument is the local directory name (not path - unlike hsi.put)

context.get('hpss/path/some.tar.gz', '/usr/local/tmp', function(err) {
    if(err) throw err;
}, function(progress) {
    console.dir(progress);
});

You can receive progress report via the 2nd callback function you provide (optional)

{ progress: 0.4205854166191833,
  total_size: 508599432,
  transferred_size: 213909504,
  elapsed_time: 5251 }
{ progress: 0.8494176061132526,
  total_size: 508599432,
  transferred_size: 432013312,
  elapsed_time: 10274 }
{ progress: 1,
  total_size: 508599432,
  transferred_size: 508599432,
  elapsed_time: 12279 }

See test/test.js for error handling

References

For a bit more detail on hsi/htar commands see https://www.olcf.ornl.gov/kb_articles/transferring-data-with-hsi-and-htar/

TODO

I haven't implemented commands for htar yet. htar doesn't seems to allow access through firewall-ed environment. Unlike hsi where I can specify "firewall -on" on the command line, I can't find an equivalent flag for htar. My dev/prod environment are behind firewall currently, so I can't develop (and it will be useless in prod) until I can find a way to go around this problem