Git Product home page Git Product logo

dlcli's Introduction

install dlcli using pip

pip install dlcli

set your org, account and api key by creating ~/dlcli.yaml

---
account: account_name
key: key_from_account_settings
org: orgname
url: https://api.outlyer.com/v1

Or you can update the file interactively.

dlcli set org acme-ltd
dlcli set account staging
dlcli set key xxxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx

these get stored in ~/dlcli.yaml so the details only need to be changed when you are switching orgs or accounts

now verify you have a successful connection

dlcli status

then get a list of all of your agents

dlcli get agents

fun! this is a work in progress so if you want to collaborate please raise PR's

dlcli commands can be thought of as a series of nested commands, with each stage having its own options and flags.

dlcli [FLAGS] COMMAND [FLAGS] SUBCOMMAND [FLAGS]

The square braces indicate optional elements. Some commands have flags, some do not. Some of those flags are optional, some are mandatory per the command. See the list of commands and flags for more information.

The first thing to know is that help is never far away. You can use the --help flag at any stage to discover which flags are available:

dlcli --help
dlcli COMMAND --help
dlcli COMMAND SUBCOMMAND --help

Understand that using the --help flag in between two nested commands will result in the previous level --help output being shown.

dlcli --help COMMAND will have the same output as dlcli --help, and likewise, dlcli COMMAND --help SUBCOMMAND will have the same output as dlcli COMMAND --help.

The top-level help output looks like this:

Note that all available flags and commands for this level are shown. This pattern is repeated at each successive level of --help

You can use the API code outside of the command line utility.

from dlcli import api

settings = {
    'url': 'https://api.outlyer.com/v1',
    'org': 'org_name',
    'account': 'account_name',
    'key': 'api_key',
}

print api.agents.get_agents(**settings)

Where org_name, account_name and api_key need to be updated with your personal settings.

dlcli's People

Contributors

anatolijd avatar cyberwolf avatar gonzohunter avatar hasbobby avatar sacreman avatar thibaultlaurens avatar tomashley avatar tradel avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

dlcli's Issues

If account/org does not exist, no error is given; Silently fails

I have the following as my config
with the proper account being orgname and the account being abc123 the values were reversed:

---
# Account is the orig
# org is the account
account: "orgname"
org: "abc123"
key: **REDACTED**
url: https://api.dataloop.io/v1

This configuration fails, but silently with no sign of error. The UI never updates with an error or an annotation.

Expected result: error message, even with --debug enabled to explain to the user that something is amiss.

Updated Pysparklines library could cause breakage for your project

I see your requirements specifies pysparklines>=0.9 and I just wanted to let you know that the recently released 1.0 does not support Python versions before 3, so could cause your project issues. I would change your requirements.txt to use pysparklines==0.9 to resolve this problem until your project is fully Python 3 compatible.

print "Min: %d Max: %d Avg: %d %s " % (min(points), max(points), sum(points)/len(points), sparkline.sparkify(points).encode('utf-8'))

Fails to find settings file

From a clean install, it appears that the save_setting function invoked in the set subcommand is unhappy:

$ dlcli set org moz
Traceback (most recent call last):
  File "/vagrant/venv/bin/dlcli", line 11, in <module>
    sys.exit(main())
  File "/vagrant/venv/lib/python2.7/site-packages/dlcli/dlcli.py", line 5, in main
    cli(obj={"filters": []})
  File "/vagrant/venv/lib/python2.7/site-packages/click/core.py", line 716, in __call__
    return self.main(*args, **kwargs)
  File "/vagrant/venv/lib/python2.7/site-packages/click/core.py", line 696, in main
    rv = self.invoke(ctx)
  File "/vagrant/venv/lib/python2.7/site-packages/click/core.py", line 1060, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/vagrant/venv/lib/python2.7/site-packages/click/core.py", line 1060, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/vagrant/venv/lib/python2.7/site-packages/click/core.py", line 889, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/vagrant/venv/lib/python2.7/site-packages/click/core.py", line 534, in invoke
    return callback(*args, **kwargs)
  File "/vagrant/venv/lib/python2.7/site-packages/dlcli/cli/set.py", line 23, in org
    save_setting(setting={"org": str(org)}, **context.settings)
  File "/vagrant/venv/lib/python2.7/site-packages/dlcli/api/utils.py", line 56, in save_setting
    with open(settings_file, 'w') as yaml_file:
IOError: [Errno 2] No such file or directory: ''

Display error message and cancel operation to set account to invalid name.

Whenever I set my account to a bogus account name (on accident of course) I think the tool should immediately give me an error and cancel the operation to set the tool to the bogus state. Right now this is what happens. I set my account to 'blah':

$ ❯❯❯ dlcli set account blah
$ ❯❯❯ dlcli status | grep -v Key
URL: https://app.dataloop.io/api/v1/orgs/desk/accounts
Organization: desk
Account: blah
Authenticated: True
$ ❯❯❯ dlcli get dashboards
Traceback (most recent call last):
  File "/usr/local/bin/dlcli", line 9, in <module>
    load_entry_point('dlcli==0.0.39', 'console_scripts', 'dlcli')()
  File "/Library/Python/2.7/site-packages/dlcli/dlcli.py", line 5, in main
    cli(obj={"filters": []})
  File "/Library/Python/2.7/site-packages/click/core.py", line 716, in __call__
    return self.main(*args, **kwargs)
  File "/Library/Python/2.7/site-packages/click/core.py", line 696, in main
    rv = self.invoke(ctx)
  File "/Library/Python/2.7/site-packages/click/core.py", line 1060, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/Library/Python/2.7/site-packages/click/core.py", line 1060, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/Library/Python/2.7/site-packages/click/core.py", line 889, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/Library/Python/2.7/site-packages/click/core.py", line 534, in invoke
    return callback(*args, **kwargs)
  File "/Library/Python/2.7/site-packages/click/decorators.py", line 17, in new_func
    return f(get_current_context(), *args, **kwargs)
  File "/Library/Python/2.7/site-packages/dlcli/cli/get.py", line 37, in dashboards
    for dashboard in Dashboards(ctx).get_dashboards():
  File "/Library/Python/2.7/site-packages/dlcli/api/dashboards.py", line 17, in get_dashboards
    headers=self.headers).json()
  File "/Library/Python/2.7/site-packages/requests/models.py", line 808, in json
    return complexjson.loads(self.text, **kwargs)
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/json/__init__.py", line 338, in loads
    return _default_decoder.decode(s)
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/json/decoder.py", line 366, in decode
    obj, end = self.raw_decode(s, idx=_w(s, 0).end())
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/json/decoder.py", line 384, in raw_decode
    raise ValueError("No JSON object could be decoded")
ValueError: No JSON object could be decoded

I discovered this originally when I had set my account to "pord" and not "prod". It took me a few minutes to figure out the issue since the error message did not tell me what the real issue was.

Canonicalize YAML mapping order

We commit our exported dashboards to source control. Yesterday I exported one of my dashboards and today I pulled it again and it appeared that some of the keys had been reordered. Here's a snippet from the diff:

@@ -28,25 +28,25 @@ positions:
     col: 4
     size_x: 3
     size_y: 3
-    filter: avg
-    legend: false
     icon: true
+    legend: false
+    filter: avg
     series:

Is it possible to canonicalize the order of mapping keys?

No feedback when pushing dashboards.

When trying to update dashboards, the user gets 0 feedback if the operation was successful or not.
While working on dashboards, I accidentally introduced some bad formatting in my yaml. For a bit I thought there was something wrong with the dataloop service because none of my changes were showing up on the website.

To illustrate this issue, if one creates an empty yaml file, the output of dlcli is the same as pushing a valid yaml file.

~/D/c/g/assistly ❯❯❯ touch blah.yaml
~/D/c/g/assistly ❯❯❯ dlcli push dashboard blah.yaml
~/D/c/g/assistly ❯❯❯ echo $?
0

Performing 'get alerts' just hangs.

Trying to get some info around my alerts. Running this command and I see nothing:

dlcli --debug --loglevel DEBUG get alerts

However, 'get dashboards' works.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.