Skip to main content

queenbee-pollination extends queenbee to interact with the Pollination API

Project description

queenbee-pollination

queenbee-pollination extends queenbee in order to interact with the Pollination API.

Installation

You can install this as a cli tool using the following command:

pip install queenbee-pollination[cli]

CLI QuickStart

Authentication

When you first run any queenbee-pollination command through the CLI you will be required to enter some authentication details so that the tool can interact with the Pollination API using your account.

You will need your Pollination API token Key and ID which can be found on your account page.

You will be prompted to do so by the CLI as demonstrated below:

> queenbee pollination workflows

Looks like this is your first time logging in.

To interract with Pollination you need to save authentication credentials in C:\Users\me\.queenbee

This tool will walk you through this process:

Enter your API Token ID: f15be412fe6f41dc01440f2363a13fed
Enter your API Token Secret: 
Logging in using api tokens...
Success!

You can now run queenbee pollination commands as an authenticated user!
Check the and modify the config file at your own risk: C:\Users\me\.queenbee

You can now check the configuration file saved at the path indicated in you command line. in the case of the example above the path to the config file is: C:\Users\me\.queenbee.

Hello World!

We have compiled a quick demo workflow for you to test out the queenbee-pollination plugin.

Copy and save the text below into a file called hello.yaml.

type: workflow
name: hello-world

operators:
- name: whalesay
  image: docker/whalesay

templates:
- type: function
  name: cowsay
  operator: whalesay
  inputs:
    parameters:
    - name: word
  command: cowsay {{inputs.parameters.word}}

flow:
  name: say-hello-world
  tasks:
  - name: say-hello
    template: cowsay
    arguments:
      parameters:
      - name: word
        value: hello
  - name: say-world
    template: cowsay
    dependencies: ['say-hello']
    arguments:
      parameters:
      - name: word
        value: world
  - name: exclamate
    template: cowsay
    dependencies: ['say-world']
    arguments:
      parameters:
      - name: word
        value: '!'
  1. Save the workflow to the Pollination platform
> queenbee pollination workflows create -f hello.yaml

Succesfully updated workflow hello-world
ID: 7ceff0de-2ed9-4e89-b943-9d3f2754ad0f
  1. List your existing workflows
> queenbee pollination workflows list

  ID                                    Name
------------------------------------  ------------------------------
2444c12f-06f3-47c9-9566-e71860017961  hello-world
  1. Schedule a simulation to run using the hello-world workflow template
> queenbee pollination simulations schedule -w 2444c12f-06f3-47c9-9566-e71860017961

Succesfully created simulation: f01b6926-c953-4b4d-be7f-945aafa1ec5c
  1. Resubmit the simulation a couple of times to create multiple simulations.
> queenbee pollination simulations resubmit -i f01b6926-c953-4b4d-be7f-945aafa1ec5c

Succesfully created simulation: 7b78543f-e929-4876-bb23-88775f69ffc9
  1. List all running simulations
> queenbee pollination simulations list

ID                                    Workflow                        Phase      Completed    Stated At                  Finished At
------------------------------------  ------------------------------  ---------  -----------  -------------------------  -------------------------
f01b6926-c953-4b4d-be7f-945aafa1ec5c  hello-world                     Succeeded  True         2019-12-11 07:59:05+00:00  2019-12-11 07:59:23+00:00
c7a681d2-2b1c-414e-bc9e-88cf0bfcaf84  hello-world                     Succeeded  True         2019-12-11 07:57:50+00:00  2019-12-11 07:57:50+00:00
e5fa5b0b-7253-47cd-a6a0-63b2f5249cf4  hello-world                     Succeeded  True         2019-12-11 07:54:46+00:00  2019-12-11 07:54:46+00:00
e556c46e-f71e-4bd5-927b-f4ce6a1d1e73  hello-world                     Succeeded  True         2019-12-11 07:49:39+00:00  2019-12-11 07:49:39+00:00
  1. Retrieve the logs from the latest ran workflow. The command below will download all logs into the dump/logs/ folder.
> queenbee pollination simulations download -i f01b6926-c953-4b4d-be7f-945aafa1ec5c -f dump -a logs
  1. Retrieve all persisted simulation data to a local folder called sim-data.
> queenbee pollination simulations download -i f01b6926-c953-4b4d-be7f-945aafa1ec5c -f sim-data
  1. Inpect simulation metadata in detail. Get and save the simulation object into a file called dump.json
> queenbee pollination simulations get -i f01b6926-c953-4b4d-be7f-945aafa1ec5c -f dump.json

Artifacts

You can also upload raw files to the Pollination storage bucket. These files will then be accessible to any simulation you run thereafter.

Create

Create a folder called test and place some files in it. You can then upload these files using the following command:

> queenbee pollination artifacts upload -f test

Uploaded test/file1.txt
Uploaded test/file2.txt
Uploaded test/file3.txt

List

You can list all files within your pollination folder by running the following command:

> queenbee pollination artifacts list

Name                            Path                                                                             Size (Mb)  Last Modified
------------------------------  -----------------------------------------------------------------------------  -----------  --------------------------------
room.pts                        daylight/project_folder/asset/grid/room.pts                                       0.10778   2019-12-13 03:35:02.526000+00:00
room.pts.bkup                   daylight/project_folder/asset/grid/room.pts.bkup                                  0.004248  2019-12-13 03:34:58.764000+00:00
rflux_sky.rad                   daylight/project_folder/asset/sky/rflux_sky.rad                                   0.000196  2019-12-13 03:34:56.755000+00:00
sky.rad                         daylight/project_folder/asset/sky/sky.rad                                         0.00018   2019-12-13 03:34:57.345000+00:00

Delete

Artifacts can be deleted by using a prefix of exact file key. Here is an exampled to delete all files within a folder called daylight/project_folder/:

> queenbee pollination artifacts delete -p daylight/project_folder

Poof... All gone!

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

queenbee_pollination-0.3.0.tar.gz (11.0 kB view hashes)

Uploaded Source

Built Distribution

queenbee_pollination-0.3.0-py2.py3-none-any.whl (9.0 kB view hashes)

Uploaded Python 2 Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page