Skip to content

CANFAR with Skaha

Installing Skaha

Skaha is available via pip. To install simply use:

Text Only
pip install skaha

Skaha Requires a CADC Certificate

Generating a CADC certificate can be done using tools from the vos python module. This is installable using pip install vos.

Bash
cadc-get-cert -u [USERNAME]

Typical Workflow in Python

Python
In [1]: from skaha import images

In [2]: i = images.Images()

In [3]: i.fetch() # Lists all images at CANFAR you can access
Out[3]:
['images.canfar.net/canucs/canucs:1.2.4',
 'images.canfar.net/canucs/canucs:1.2.3',
 ...,
 'images.canfar.net/uvickbos/sora:0.3',
 'images.canfar.net/uvickbos/find_moving:0.1']

In [4]: i.fetch(kind="headless") # Kind will filter the results
Out[4]:
['images.canfar.net/chimefrb/ubuntu:latest',
 'images.canfar.net/chimefrb/pearlman_psr_sandbox:latest',
 'images.canfar.net/chimefrb/pearlman_psr_gating:latest',
 'images.canfar.net/chimefrb/pearlman_fpylll:latest',
 'images.canfar.net/chimefrb/network-tools:latest',
 'images.canfar.net/chimefrb/pylll:latest',
 'images.canfar.net/chimefrb/pearlman_sandbox:latest',
 'images.canfar.net/chimefrb/maestro-datatrail-client:latest',
 'images.canfar.net/chimefrb/baseband-polarization:latest',
 'images.canfar.net/chimefrb/baseband-localization:latest',
 'images.canfar.net/chimefrb/frb-calibration:latest',
 'images.canfar.net/chimefrb/iautils:latest',
 'images.canfar.net/chimefrb/alpine:latest',
 'images.canfar.net/lsst/lsst_v19_0_0:0.1',
 'images.canfar.net/skaha/lensfit:22.11',
 'images.canfar.net/skaha/lensfit:22.10',
 'images.canfar.net/skaha/lensingsim:22.07',
 'images.canfar.net/skaha/phosim:5.6.11',
 'images.canfar.net/skaha/terminal:1.1.1',
 'images.canfar.net/uvickbos/pycharm:0.1',
 'images.canfar.net/uvickbos/swarp:0.1',
 'images.canfar.net/uvickbos/isis:2.2',
 'images.canfar.net/uvickbos/find_moving:0.1']

In [5]: from skaha import context

In [6]: c = context.Context()

In [7]: c.resources() # Lists the requestable resources when spawning container
Out[7]:
{'defaultCores': 2,
 'defaultCoresHeadless': 1,
 'availableCores': [1, 2, 4, 8, 16],
 'defaultRAM': 16,
 'defaultRAMHeadless': 4,
 'availableRAM': [1, 2, 4, 8, 16, 32, 64, 128, 192],
 'availableGPUs': [1,
  2,
  3,
  4,
  5,
  6,
  7,
  8,
  9,
  10,
  11,
  12,
  13,
  14,
  15,
  16,
  17,
  18,
  19,
  20,
  21,
  22,
  23,
  24,
  25,
  26,
  27,
  28]}

In [8]: from skaha import session

In [9]: s = session.Session()

In [11]: resp = s.create(
                  name='test',
                  image='images.canfar.net/chimefrb/ubuntu:latest',
                  cores=1,
                  ram=1,
                  kind='headless',
                  cmd='ls') # Starts a session on CANFAR, returns an id
2022-11-09 11:54:12,712 - skaha-client-skaha.session - INFO -
{'type': 'headless', 'cmd': 'ls'}

In [12]: s.logs(resp) # View the logs from above command
Out[12]: ['']

In [13]: s.info(resp) # List the status
Out[13]: '{
            "id": "ocw58y6u",
            "userid": "tzegmott",
            "image": "images.canfar.net/chimefrb/ubuntu:latest",
            "type": "headless",
            "status": "Succeeded",
            "name": "test",
            "startTime": "2022-11-09T16:54:15Z",
            "connectURL": "not-applicable"
          }'

In [14]: s.destroy(resp) # Close the container when you are finished
Out[14]: True