Git Product home page Git Product logo

orca's Introduction

Orca

orca logo

npm version MIT License

Orca is an Electron app that generates images and reports of Plotly things like plotly.js graphs, dash apps, dashboards from the command line. Additionally, Orca is the backbone of Plotly's Image Server. Orca is also an acronym for Open-source Report Creator App.

Visit plot.ly to learn more or visit the Plotly forum.

Follow @plotlygraphs on Twitter for Orca announcements.

Installation

Method 1: conda

If you have conda installed, you can easily install Orca from the plotly conda channel using:

$ conda install -c plotly plotly-orca

which makes the orca executable available on the path of current conda environment.

Method 2: npm

If you have Node.js installed (recommended v8.x), you can easily install Orca using npm as:

$ npm install -g [email protected] orca

which makes the orca executable available in your path.

Method 3: Docker

$ docker pull quay.io/plotly/orca

Usage

If no arguments are specified, it starts an Orca server on port 9091. You can publish the port to the outside world the usual way:

$ docker run -d -p 9091:9091 quay.io/plotly/orca

If the first argument is graph, it executes the command line application orca graph:

$ docker run -i quay.io/plotly/orca graph --help

Method 4: Standalone binaries

Alternatively, you can download the standalone Orca binaries corresponding to your operating system from the release page. Then, on

Mac OS

  • Unzip the mac-release.zip file.
  • Double-click on the orca-X.Y.Z.dmg file. This will open an installation window.
  • Drag the orca icon into the Applications folder.
  • Open finder and navigate to the Applications/ folder.
  • Right-click on the orca icon and select Open from the context menu.
  • A password dialog will appear asking for permission to add orca to your system PATH.
  • Enter you password and click OK.
  • This should open an Installation Succeeded window.
  • Open a new terminal and verify that the orca executable is available on your PATH.
$ which orca
/usr/local/bin/orca

$ orca --help
Plotly's image-exporting utilities

  Usage: orca [--version] [--help] <command> [<args>]
  ...

Windows

  • Extract the windows-release.zip file.
  • In the release folder, double-click on orca Setup X.Y.Z, this will create an orca icon on your Desktop.
  • Right-click on the orca icon and select Properties from the context menu.
  • From the Shortcut tab, copy the directory in the Start in field.
  • Add this Start in directory to you system PATH (see below).
  • Open a new Command Prompt and verify that the orca executable is available on your PATH.
> orca --help
Plotly's image-exporting utilities

  Usage: orca [--version] [--help] <command> [<args>]
  ...
Windows References

Linux

  • Make the orca AppImage executable.
$ chmod +x orca-X.Y.Z-x86_64.AppImage
  • Create a symbolic link named orca somewhere on your PATH that points to the AppImage.
$ ln -s /path/to/orca-X.Y.Z-x86_64.AppImage /somewhere/on/PATH/orca
  • Open a new terminal and verify that the orca executable is available on your PATH.
$ which orca
/somewhere/on/PATH/orca

$ orca --help
Plotly's image-exporting utilities

  Usage: orca [--version] [--help] <command> [<args>]
  ...
Linux Troubleshooting: Cannot open shared object

The Electron runtime depends a several common system libraries. These libraries are pre-installed in most desktop Linux distributions (e.g. Ubuntu), but are not pre-installed on some server Linux distributions (e.g. Ubuntu Server). If a shared library is missing, you will see an error message like:

$ orca --help
orca: error while loading shared libraries: libgtk-x11-2.0.so.0:
cannot open shared object file: No such file or directory

These additional dependencies can be satisfied by installing:

  • The libgtk2.0-0 and libgconf-2-4 packages from your distribution's software repository.
  • The chromium-browser package from your distribution's software repository.
Linux Troubleshooting: Headless server configuration

The Electron runtime requires the presence of an active X11 display server, but many server Linux distributions (e.g. Ubuntu Server) do not include X11 by default. If you do not wish to install X11 on your server, you may install and run orca with Xvfb instead.

On Ubuntu Server, you can install Xvfb like this:

$ sudo apt-get install xvfb

To run orca under Xvfb, replace the symbolic link suggested above with a shell script that runs the orca AppImage executable using the xvfb-run command.

#!/bin/bash
xvfb-run -a /path/to/orca-X.Y.Z-x86_64.AppImage "$@"

Name this shell script orca and place it somewhere on your system PATH.

Linux References

Quick start

From the command line: Unix/MacOS:

$ orca graph '{ "data": [{"y": [1,2,1]}] }' -o fig.png

Windows:

orca graph "{ \"data\": [{\"y\": [1,2,1]}] }" -o fig.png

generates a PNG from the inputted plotly.js JSON attributes. Or,

$ orca graph https://plot.ly/~empet/14324.json --format svg

generates an SVG from a plotly.js JSON hosted on plot.ly.

When running

To print info about the supported arguments, run:

$ orca --help
$ orca <command> --help

To call orca from a Python script:

from subprocess import call
import json
import plotly

fig = {"data": [{"y": [1,2,1]}]}
call(['orca', 'graph', json.dumps(fig, cls=plotly.utils.PlotlyJSONEncoder)])

To call orca from an R script:

library(plotly)

p <- plot_ly(x = 1:10, y = 1:10, color = 1:10)
orca(p, "plot.svg")

API usage

Using the orca npm module allows developers to build their own Plotly exporting tool. We export two Electron app creator methods run and serve. Both methods return an Electron app object (which is an event listener/emitter).

To create a runner app:

// main.js

const orca = require('orca/src')

const app = orca.run({
  component: 'plotly-graph',
  input: 'path-to-file' || 'glob*' || url || '{data: [], layout: {}}' || [/* array of those */],
  debug: true
})

app.on('after-export', (info) => {
  fs.writeFile('output.png', info.body, (err) => console.warn(err))
})

// other available events:
app.on('after-export-all', () => {})
app.on('export-error', () => {})
app.on('renderer-error', () => {})

then launch it with electron main.js

Or, to create a server app:

// main.js

const orca = require('orca/src')

const app = orca.serve({
  port: 9090,
  component: 'component name ' || [{
    name: 'plotly-graph',
    path: /* path to module if none given, tries to resolve ${name} */,
    route: /* default to same as ${name} */,

    // other options passed to component methods
    options: {
      plotlyJS: '',
      mathjax: '',
      topojson: '',
      mapboxAccessToken: ''
    }
  }, {
    // other component
  }, {
    // other component ...
  }],

  debug: false || true
})

app.on('after-export', (info) => {
  console.log(info)
})

// other available events:
app.on('after-connect', () => {})
app.on('export-error', () => {})
app.on('renderer-error', () => {})

then launch it with electron main.js

Plotly's image server

Plotly's image server is dockerized and deployed here. See the deployment/ README for more info.

System dependencies

If you don't care about exporting EPS or EMF you can skip this section.

The environment you're installing this into may require Poppler for EPS exports and Inkscape for EMF exports.

Poppler installation via Aptitude (used by some *nix/BSD, e.g. Ubuntu)

$ apt-get install poppler-utils (requires `sudo` or root privileges)

Poppler installation via Homebrew (third-party package manager for Mac OS X)

$ brew install poppler

Inkscape installation via Aptitude (used by some *nix/BSD, e.g. Ubuntu)

$ apt-get install inkscape (requires `sudo` or root privileges)

Inkscape installation via Homebrew (third-party package manager for Mac OS X)

$ brew install inkscape

Contributing

See CONTRIBUTING.md. You can also contact us if you would like a specific feature added.

Tests and Linux builds Mac OS build Windows build Docker build
CircleCI Build Status AppVeyor Docker Repository on Quay

License

Code released under the MIT © License.

orca's People

Contributors

antoinerg avatar bronsolo avatar chriddyp avatar chrispahm avatar cpsievert avatar dependabot[bot] avatar ejdamm avatar etpinard avatar gvwilson avatar jackparmer avatar jamescropcho avatar jkaplowitz avatar joaoalf avatar jonmmease avatar josegonzalez avatar justin-sleep avatar mag009 avatar monfera avatar n-riesco avatar nicolaskruchten avatar safi2510 avatar scjody avatar tarzzz avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

orca's Issues

imageserver monitoring & restarts for On-Prem

Another issue coming out of https://github.com/plotly/streambed/issues/9865#issuecomment-349995119 is that (like the old imageservers) the new ones aren't 100% reliable. For Plotly Cloud, this is OK because Kubernetes performs health checks and will restart any hung pods, but for On-Prem we need a solution.

Existing imageservers are monitored by monit. We can probably use this in the new imageserver container by starting it in the background from the run_server script, but that needs to be tested.

@bpostlethwaite @BRONSOLO Do you have any other ideas?

Hang after too many gl requests in Docker

From the tests documented starting at https://github.com/plotly/streambed/issues/9865#issuecomment-349995119:

When image-exporter is run as an imageserver in Docker, after a small number of gl requests (30-40), the image-exporter hangs completely. The request in progress times out, and the server won't accept any more connections and must be restarted.

Two examples:

  • If test/image-make_baseline.js is used to run gl*, it hangs at gl3d_chrisp-nan-1.json.
  • If test/image-make_baseline.js is used to run gl3d*, it makes it past gl3d_chrisp-nan-1.json and hangs at gl3d_snowden_altered.json.

This means that the issue is unlikely to be specific to any one plot, but rather some resource becomes exhausted or something builds up to the point where image generation can't proceed.

@etpinard @monfera FYI

Design what's rendered for `text` components in `dashboard-thumbnail`

A thumbnail is a typically small representation of a bag of visual components.

For plot component, the current design involves the elimination of various annotations and padding, to maximize panel space for data ink.
Dashboards have less graphical components eg. text. Theyr'e currently bypassed by #33 but future options include:

  1. Leave it as with #33 ie. skip text panels. The benefit is that we're not spending one of the available 4 rectangles for content that doesn't convey much in typical thumbnail size. It's expected that plot renders are better at making the user recall what the dashboard is about than a text fragment, and the dashboard already has a text description (title text).
  2. Add some icon symbolizing text, e.g. a stylized letter "A", or "¶" or the text editor symbol for a multirow text paragraph or page such as https://www.iconexperience.com/_img/i_collection_png/512x512/plain/text_align_left.png - benefit is that the presence of text will be conveyed (if it's among the first 4 plot components), and fairly easy to implement, the drawback is that it's wasteful esp. if the thumbnail is unusually large
  3. Add actual text: the text would be removed of formatting (or not?) and a font size would be chosen (10..16px), perhaps configurable, that's probably readable; then text would be rendered with minimal margins and row pitch to make a meaningful amount fit - a real constraint if it's indeed a thumbnail size.

Please vote, add, remove or expand in comments.

`npm run pack` fails with node@6 and npm@3

Today, when I tried to build orca, npm run pack failed because I was using node@6 that comes with npm@3. This is what happened:

Next I ran npm install -g npm@5, but npm i failed with some security error on lodash.

As recommended by the error message, I ran npm install -g npm@6. This time npm i installed the packges but in the end it failed (I don't remember the details, but I do remember I suspected that node@6 was unable to run npm@6).

Since the packages were already installed in node_modules, I decided to run npm install -g npm@5 again. This time npm i didn't fail. I confirmed [email protected] was installed and run npm run pack without problems.


I see options to move forward:

  1. contact the maintainer of read-config-file and request es2015 to be the transpilation target (instead of es2017)
  2. drop support for node@6

Poor thumbnails for pie charts

The thumbnails for pie charts could be improved:

  • An axis is shown, even though pie charts normally don't have axes.
  • Background colours are ignored. (This might be the case for all plots, which is unfortunate because background colours are useful to differentiate between plots.)

Example:

screen shot 2017-12-06 at 11 25 35

newplot

@etpinard @monfera FYI

Note that this is not a regression from the old imageserver code.

How to run the standalone app on Mac/Unix?

Hi

I downloaded the binaries for plotly-graph-exporter from here.

What should I do next to run the below command successfully on my machine (Macbook)?
plotly-graph-exporter '{ "data": ["y": [1,2,3]] }' -o fig.png

Sorry if this is a trivial question.

Thanks
Dhruv

Investigate ways to do text shadowing

... that gets along with printToPDF

From @alexcjohnson in #6 :

polar text gets a white shadow behind it, which seems to get corrupted by printToPDF... but it looks like Batik is dropping the shadow entirely, which is arguably less bad but still not correct. Parcoords is supposed to have a similar shadow on tick labels, which it appears both printToPDF and Batik miss. Would be worth spending some time figuring out if there's a more robust way to apply this shadowing.

Error: 'plotly-image-exporter' is not in the npm registry.

Hi

I get the below error when I run npm install -g electron plotly-image-exporter on my machine(Macbook). Can someone help me in getting rid of this error?

npm ERR! Darwin 17.4.0
npm ERR! argv "/usr/local/bin/node" "/usr/local/bin/npm" "install" "-g" "electron" "plotly-image-exporter"
npm ERR! node v6.9.1
npm ERR! npm  v3.10.8
npm ERR! code E404

npm ERR! 404 Registry returned 404 for GET on https://registry.npmjs.org/plotly-image-exporter
npm ERR! 404 
npm ERR! 404  'plotly-image-exporter' is not in the npm registry.
npm ERR! 404 You should bug the author to publish it (or use the name yourself!)
npm ERR! 404 
npm ERR! 404 Note that you can also install from a
npm ERR! 404 tarball, folder, http url, or git url.

GL_INVALID_OPERATION errors

Hi,
Thanks for this great tool!

I'm seeing the following:

In [6]: from subprocess import call
   ...: import json
   ...:
   ...: fig = {"data": [{"y": [1,2,1]}]}
   ...: call(['orca', 'graph', json.dumps(fig), '-o', 'myfig.pdf', '--format', 'pdf'])
   ...:
   ...:
[43121:0625/111408.782905:ERROR:gles2_cmd_decoder.cc(17766)] [.RenderCompositor-0x7fb7e4022000]GL ERROR :GL_INVALID_OPERATION : glBindTexImage2DCHROMIUM: no image found with the given ID
[43121:0625/111408.783020:ERROR:gles2_cmd_decoder.cc(17766)] [.RenderCompositor-0x7fb7e4022000]GL ERROR :GL_INVALID_OPERATION : glBindTexImage2DCHROMIUM: no image found with the given ID
[43121:0625/111408.783125:ERROR:gles2_cmd_decoder.cc(4395)] [.RenderWorker-0x7fb7e500c200.GpuRasterization]GL ERROR :GL_INVALID_FRAMEBUFFER_OPERATION : glClear: framebuffer incomplete
[43121:0625/111408.783161:ERROR:gles2_cmd_decoder.cc(4395)] [.RenderWorker-0x7fb7e500c200.GpuRasterization]GL ERROR :GL_INVALID_FRAMEBUFFER_OPERATION : glDrawElements: framebuffer incomplete
[43121:0625/111408.783182:ERROR:gles2_cmd_decoder.cc(4395)] [.RenderWorker-0x7fb7e500c200.GpuRasterization]GL ERROR :GL_INVALID_FRAMEBUFFER_OPERATION : glDrawArrays: framebuffer incomplete
[43121:0625/111408.783204:ERROR:gles2_cmd_decoder.cc(4395)] [.RenderWorker-0x7fb7e500c200.GpuRasterization]GL ERROR :GL_INVALID_FRAMEBUFFER_OPERATION : glDrawElements: framebuffer incomplete
[43121:0625/111408.783228:ERROR:gles2_cmd_decoder.cc(4395)] [.RenderWorker-0x7fb7e500c200.GpuRasterization]GL ERROR :GL_INVALID_FRAMEBUFFER_OPERATION : glDrawElements: framebuffer incomplete

The errors appear harmless, though, as myfig.pdf is still successfully generated. As far as I can tell, the pdf is valid and looks fine.

Environment:

Python 3.6.5
OS X 10.13.5

Orca was installed with ~ $ npm install -g [email protected] orca just now.

PyGIWarning on headless Ubuntu

I installed using the README instruction (download the AppImage, do chmod, add to path), and ran it on Ubuntu, go the error message below. Did the same thing on my mac it worked.

OS: Ubuntu 16.04, it is a headless server (no monitor)
orca release used: https://github.com/plotly/orca/releases/tag/v1.0.0

orca graph '{ "data": [{"y": [1,2,1]}] }' -o fig.png
/usr/lib/python3/dist-packages/pyatspi/__init__.py:17: PyGIWarning: Atspi was imported without specifying a version first. Use gi.require_version('Atspi', '2.0') before import to ensure that the right version gets loaded.
  from gi.repository import Atspi
Failed to connect to Mir: Failed to connect to server socket: No such file or directory
Unable to init server: Could not connect: Connection refused
Failed to connect to Mir: Failed to connect to server socket: No such file or directory
Unable to init server: Could not connect: Connection refused
The following are not valid: graph { "data": [{"y": [1,2,1]}] } -o fig.png
Cannot start the screen reader because it cannot connect to the Desktop.

Test failure: `pdftops.pdf2eps > should convert pdf to eps`

Greetings, all.

Locally I get this test failure:

  pdftops.pdf2eps > should convert pdf to eps
  not ok min pdf file size
    at:
      line: 25
      column: 11
      file: test/unit/pdftops_test.js
      type: global
      function: fs.writeFile
    stack: |
      fs.writeFile (test/unit/pdftops_test.js:25:11)
    source: |
      t.ok(size > 1e5, 'min pdf file size')

On my machine, size is 93,248, just shy of 1e5.

I am happy to fix this (by changing 1e5 to 1e4), and just as happy to ignore it. Direct me as you see fit.

I raise this issue on the chance that my local machine is behaving badly in some subtle way. If this looks worrisome for some reason, let me know.

James

Orca CLI doesn't work with Python subprocess.Popen

Well, I've just tried to create an image by using orca within the python api. However this code doesn't produce any image:

import subprocess

json_res = json.dumps({"data": [{"y": [1,2,1]}]})
command = f"orca graph {json_res} -o fig.png" 
process = subprocess.Popen(command, stdout=subprocess.PIPE, stderr=None, shell=True)

#Launch the shell command:
output = process.communicate()

print (output[0])

It returns: done with code 1 in 2.59 ms - failed or incomplete task(s)

[WIP] orca as a conda package

TLDR

I made a WIP conda package for orca:

try out the package with:

$ conda install -c jonmmease plotly-orca

OS X 64, Linux 64, and Windows 64 are all available

Background

In preparation for adding orca image export support to plotly.py, I spent some time today working on a conda package recipe for orca.

Having a conda package means that conda users can install orca with a single command that's consistent across operating systems. It also means that plotly.py and orca can be installed together with a single command:

# Install both plotly.py and orca
$ conda install -c jonmmease plotly plotly-orca

For the time being I just published the packages to my own personal channel (that's the -c jonmmease part), but we should be able to get this into conda-forge at some point, and hopefully even into the official channel eventually. If we get the package into the official main channel, the -c jonmmease part wouldn't be needed.

Approach

The build recipe is actually ended up being fairly simple. See https://github.com/jonmmease/orca-feedstock.

Here's the general flow that's common to each OS (I've tested OS X, Linux, and Windows 64)

  • Clone the orca git repo (For my experiments I actually cloned #103 with the OS X hide dock fix)
  • npm install
  • npm run pack
  • Copy the extracted installation files into somewhere appropriate in the conda environment.
  • Add a script named orca to somewhere in the conda environment that ends up on the user's path. This orca script just passes command line args through to the orca executable copied above.

And, amazingly, everything seems to work just fine. I've tested installing the package from OS X, Ubuntu, and Windows 10. In each case I can run orca commands to perform image conversions and there are no warning messages, no windows, and no dock or taskbar flickers.

Please try it out from whatever OSs you have access to, let me know how it works, and take a look at the build recipe if you're so inclined 🙂

Notes

  • I built these packages manually using my local machine and some VMs, this should really be done on CI servers at some point.
  • The package is version 1.0.0, but that's not quite accurate. It's actually #103
  • I don't plan to generally announce this package until the release of the corresponding version of plotly.py

cc: @etpinard @nicolaskruchten @jackparmer @chriddyp @cpsievert

Fonts

Unfortunately, we'll have to install them on the system, like we currently do here.

I thought that adding something like:

<style type="text/css">
    @import url('https://fonts.googleapis.com/css?family=Open+Sans:600,400,300,200|Droid+Sans|PT+Sans+Narrow|Gravitas+One|Droid+Sans+Mono|Droid+Serif|Raleway|Old+Standard+TT');
</style>

in the SVG's <defs> would work, but no. <img> with SVG src values don't import fonts, so Plotly.toImage fails to render the fonts correctly. See this article for more details.

cc #1

Headless?

I built the project on OS X and ran the following png export command

~> bin/plotly-graph-exporter.js '{"data":[{"y": [3, 2, 5, 3]}],"layout":{}}' -o out.png

The out.png image is generated successfully, but I noticed that the electron window pops up in front of my other windows.

Is there any way to prevent the popup? I'm concerned this would be a bit disruptive for eventual python/R users.

cross reference: #21, plotly/plotly.py#880
cc: @cpsievert @etpinard @jackparmer

Autoscaling for imageservers

When image-exporter is run via Kubernetes as an imageserver, we attempted to perform autoscaling using the CPU usage metric set to 80%. This didn't work; CPU usage seems too bursty for this to be a useful metric. (Sometimes an image-exporter pod is using very little CPU even though it's busy processing a request.)

As an example, here's the CPU usage of one pod over 24h. The pod was in service on Plotly Cloud production during the first 8 or so hours.

33721369-d26071c6-db34-11e7-816d-3e495cad350b

I'm going to look into other metrics we could use. It might also be OK to use CPU usage but with a lower threshold, like 50%. As a workaround, we could also disable autoscaling temporarily and just run a large number of pods; this wouldn't be any worse than what we currently do for Plotly Cloud prod where we have 12 imageservers running at all times.

@etpinard @monfera @bpostlethwaite FYI

Distributing this thing

On top of the @plotly/image-exporter npm package , we'll add standalone Mac, Linux and Window binaries to the release section after every release similar to what's done currently in plotly-database-connector.

Standalone binaries ship with node.js and electron bundled up, but without the fonts we use on prod (if users want the fonts, they'll have to install them locally or use docker). We'll probably use electron-packager same as plotly-database-connector for this task, although there are other options. This part is easy.

Now, we need to figure how to distribute image-exporter to python and R API users. We'll also need to write (thin) python and R wrapper around the plotly-graph-exporter CLI command e.g in python:

from subprocess import call
import json

fig = {"data": [{"y": [1,2,1]}]}
call(['plotly-graph-exporter', json.dumps(fig)])

For distributing, I can think of three different options:

  1. Include the image-exporter standalone binaries in plotly.py and plotly.R packages and write the wrapper there, similar to what we currently do with the plotly.js bundle for offline. Potential problems, we'll have to make platform-dependent installs - is that possible with pip and CRAN? Download times might increase significantly too.
  2. Make new plotly-image-exporter py/pip and R/CRAN packages from this repo - which would include the py/R wrappers. This option would require platform-specific install too.
  3. Make users download and install the standalone binaries from this repo's release section, add wrapper code to plotly.py and plotly.R and make them spit out errors if called when plotly-graph-exporter isn't installed.

cc @chriddyp @cpsievert @jackparmer

How to build on Linux?

@etpinard:

Would you mind adding Linux deb target so that I can test it on my laptop? (Sorry for the inconvenience if any)

@JamesCropcho:

I have Ubuntu as the main OS on my laptop, which is a Debian distribution. AppImage is the default format for this build target. If one runs electron-builder . or similar, one would get an AppImage which one can execute on Debian.

@etpinard:

Would you opening up an issue about trying to build this thing for Linux, so that we don't forget about #52 (comment)

I am opening that issue as requested, here.

So as I had stated, we are already building for Linux via the AppImage target. (In fact, I am developing for Plotly on Ubuntu.)

So now, Étienne, to confirm, the AppImage not exactly what you're seeking, and instead the Linux build target should be replaced by deb (a Debian package), is that correct? If so, should this issue be left as a placeholder for that, or would you like me to rapidly make that configuration change?

James

errors when using conda to install r

Hello,

I've been trying to install r and keep getting the following error message. Not sure how to proceed. Appreciate any assistance. Thank you!

Include the output of the command 'conda info' in your report.

Traceback (most recent call last):
File "/home/cdmelloc/anaconda/bin/conda", line 5, in
sys.exit(main())
File "/export/home/cdmelloc/anaconda/lib/python2.7/site-packages/conda/cli/main.py", line 201, in main
args_func(args, p)
File "/export/home/cdmelloc/anaconda/lib/python2.7/site-packages/conda/cli/main.py", line 208, in args_func
args.func(args, p)
File "/export/home/cdmelloc/anaconda/lib/python2.7/site-packages/conda/cli/common.py", line 612, in inner
return func(args, parser)
File "/export/home/cdmelloc/anaconda/lib/python2.7/site-packages/conda/cli/main_install.py", line 46, in execute
install.install(args, parser, 'install')
File "/export/home/cdmelloc/anaconda/lib/python2.7/site-packages/conda/cli/install.py", line 336, in install
minimal_hint=args.alt_hint)
File "/export/home/cdmelloc/anaconda/lib/python2.7/site-packages/conda/plan.py", line 397, in install_actions
config.track_features, minimal_hint=minimal_hint):
File "/export/home/cdmelloc/anaconda/lib/python2.7/site-packages/conda/resolve.py", line 739, in solve
minimal_hint=minimal_hint)
File "/export/home/cdmelloc/anaconda/lib/python2.7/site-packages/conda/resolve.py", line 507, in solve2
clauses = set(self.gen_clauses(v, dists, specs, features))
File "/export/home/cdmelloc/anaconda/lib/python2.7/site-packages/conda/resolve.py", line 342, in gen_clauses
assert len(clause) > 1, '%s %r' % (fn1, ms)
AssertionError: r-base-3.3.1-6.tar.bz2 MatchSpec(u'_r-mutex 1.* anacondar_1')

log output

Expanding on #1 (comment)

For logging to STDERR printing single lines is easier to integrate into tools like Stackdriver which is already integrated into GKE. Printing single line JSON blobs with error information and consistent keys is even better and seems like the approach taken by newer tools. It is also much more easily digestible by monitoring endpoints.

{error: 'error message', level: 'debug', requestID: 'someRequestIDIfApplicable'}... etc.

I can help with this stuff.

Alternatives to Batik for scaling images

#6 tries to replace the batik svg to pdf converter with electron's printToPDF. At first glance, things are looking good on that front (ref #6 (comment)),

But, the old image server also uses batik to scale images (from a plotly svg to a scaled png). This gist compares the batik converter with two other node.js libraries (sharp and gm) and a browser-side solution.

The browser-side solution is looking good. It uses context.drawImage's width/height options for png/jpeg/webp formats and viewBox for SVGs.

Can anyone think of possible limitations for the browser-side solution?

Move to "two package.json" structure

Where the root package.json would list the orca npm package deps and the project dev-deps. A new package.json file placed in app/package.json would list the bare minimum standalone app deps as discussed in the electron-builder docs.

This would allow us to list electron as part of the npm package deps which would make:

npm i -g orca
orca --help

just workTM.

Moveover, moving to a two package.json structure should shrink the size of the Orca standalone app.

This might be considered a breaking change and might have to wait for a v2 bump though.

Mac installer doesn't install a CLI

I'm opening this issue to discuss solutions to install Orca as a CLI in Mac.


At the moment, electron-builder creates a DMG installer for Orca in Mac. This DMG installer is actually a disk image. And, in our case, it contains the app bundle Plotly Orca.app.

My understanding is that when a user double-clicks a .dmg file, Mac mounts this disk image and prompts the user to drag the disk image onto the Applications folder.

This means Orca is installed on /Applications/Plotly Orca.app.

To invoke Orca from the command line, we could use open:

open -a "/Applications/Plotly Orca.app" [--args arg1 ...]

This is rather cumbersome. We could simplify things by moving open -a "/Applications/Plotly Orca.app" [--args arg1 ...] into a script (e.g. /usr/local/bin/plotly-orca). I've found two ways to do this:


Could any of the mac users confirm that open -a "/Applications/Plotly Orca.app" [--args arg1 ...] works, please?


@JamesCropcho @etpinard @jackparmer what do you think about these options?

Is the `encoded` option still a thing?

The old image server parses an encoded option which is true by default. When set to false, it make the image server return an image data string (ready to be set in a <img src=""/>) as opposed to an image data buffer.

A quick grep in streambed, reveals that this option is only set in the shelly/static/js/sharing.js, meaning it's ready to be 🔪 , is that correct?

cc @bpostlethwaite

Dock icon not hidden on OS X

As discussed in #66 (comment), in order to hide the electron icon from popping up in the dock on OS X the "extendInfo": {"LSUIElement": 1} attribute should be added to the project's package.json.

I thought this had been done, and I remember testing that it worked (successfully hid the icon), but I don't see this option present on master, and the icon is not hidden when I use the dmg install on OS X.

Here's the commit that added the config d185fcf. I'm guessing it just got lost in the shuffle when PR #66 was closed in favor of #72

Unmerge docker-build and docker-push jobs

Commit 1b78585 merged the docker-build and docker-push CircleCI jobs into a single docker-build-and-push as a workaround for intermittent CI failures involving _ "missing image"_ error duiring the docker-push step. See #63 (comment)

At present, this increases our total test time by about 2 minutes. This gap is likely to increase as we add more and more image-exporter tests. Therefore, we should try at some point to unmerge those two jobs.

Try out Electron 2.0

I don't see anything breaking changes from the list on https://electronjs.org/releases#2.0.0, so the upgrade should be fairly simple.

We might want to explore new possible solutions for #12 and try out --headless as mentioned in #22.

Some thorough testing of our image server will be required though.

orca() does not support file paths

I'm trying to export a static image in R using orca(), but it ignores the file path and just exports it to the current location of the script that I'm running.

For example, if I run orca(image, "/images/plot1.png") from a script located in /code/script.R, it saves it to /code/plot1.png instead of where I specified.

Test failure: `getBody: > should pass request error for bar url`

Greetings, all.

Locally I get this test failure:

  not ok Cannot read property 'code' of null
    stack: |
      getBody (test/unit/runner_test.js:96:18)
      Request.request.get [as _callback] (src/app/runner/get-body.js:47:7)
      Request.self.callback (node_modules/request/request.js:186:22)
      Request.<anonymous> (node_modules/request/request.js:1163:10)
      IncomingMessage.<anonymous> (node_modules/request/request.js:1085:12)
    at:
      line: 96
      column: 18
      file: test/unit/runner_test.js
      function: getBody
    type: TypeError
    test: should pass request error for bar url
    source: |
      t.equal(err.code, 'ENOTFOUND', 'error')

And while code is indeed null, body is

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html><head><meta http-equiv="refresh" content="0;url=http://searchassist.verizon.com/main?ParticipantID=euekiz39ksg8nwp7iqj2fp5wzfwi5q76&FailedURI=http%3A%2F%2Fdummy.url%2F&FailureMode=1&Implementation=&AddInType=4&Version=pywr1.0&ClientLocation=us"/><script type="text/javascript">url="http://searchassist.verizon.com/main?ParticipantID=euekiz39ksg8nwp7iqj2fp5wzfwi5q76&FailedURI=http%3A%2F%2Fdummy.url%2F&FailureMode=1&Implementation=&AddInType=4&Version=pywr1.0&ClientLocation=us";if(top.location!=location){var w=window,d=document,e=d.documentElement,b=d.body,x=w.innerWidth||e.clientWidth||b.clientWidth,y=w.innerHeight||e.clientHeight||b.clientHeight;url+="&w="+x+"&h="+y;}window.location.replace(url);</script></head><body></body></html>

The ISP I'm using responds with this page when the URI has a nonexistent domain. However, body is only a string literal and so I see no quick fix.

I am happy to fix this (probably by modifying getBody()), and just as happy to ignore it. Direct me as you see fit.

I believe you would at least want to be aware of this. Not limited to, that if after I "pipify" this tool, that getBody() will be called on laptops and/or servers outside with a variety of ISP behavior.

Hoping to Help,
James

Steadily increasing memory usage

After a 2 hour run of all our mocks except gl* and mapbox* using test/image-make_baseline.js (351 mocks, taking about 55 seconds per run), against image-exporter running as an imageserver in a Docker container, memory usage grew steadily:

https://plot.ly/%7EJodyMcintyre/2209/
new imageserver memory usage

When the run was stopped, memory usage decreased a bit then leveled out.

Examination of ps results showed that two electron processes (probably the plot image and plot thumbnail processes) were responsible for the memory usage:

screen shot 2017-12-07 at 18 00 40

A similar issue was observed in a 12 hour run of 3 imageservers in our staging environment:

screen shot 2017-12-08 at 15 01 56

As a workaround for this issue we could restart Electron after a reasonably large number of requests (e.g. 1,000). I'm going to look into this but a fix for the root cause is needed at some point.

@etpinard @monfera FYI

Mapbox doesn't work in Docker (and possibly elsewhere)

If test/image-make_baseline.js is used to run mapbox* against image-exporter running as an imageserver in Docker, all mapbox tests fail and this message is printed by image-exporter:

{"severity":"ERROR","textPayload":"525 - plotly.js error","labels":{"fid":null}}

I've verified that the PLOTLY_MAPBOX_DEFAULT_ACCESS_TOKEN environment variable is set to the same token used on Plotly Cloud prod.

I also tried running ./bin/plotly-graph-exporter.js with a mapbox mock. See https://github.com/plotly/streambed/issues/9865#issuecomment-350266223 for the full command (but I'm not copying it here since it contains a Plotly Cloud mapbox access token). The results were:

libGL error: No matching fbConfigs or visuals found
libGL error: failed to load driver: swrast

done with code 1 in 1.73 ms - failed or incomplete task(s)

I'm not sure if this is the same issue or not. I believe the libGL errors are unrelated; they also happen for working mocks on my machine.

I'm going to look into this some more (my next step is to try the plotly-graph-exporter.js command with one mapbox mock from inside a Docker container).

Look for ways to improve PDF output of 'crispEdges' SVG shape rendering

From @alexcjohnson in #6:

We can ignore this for now as it's not new, but would be worth investigating later. This is happening because we apply shape-rendering: crispEdges via CSS (classed('crisp', true)) rather than inline styling. Though I notice that's not applied consistently anymore, I see a lot of places we've used inline styling. Anyway the idea, which may need refining particularly in light of electron, was to explicitly drop it from vector output so we get higher precision when the user can do stuff like put the vector image into another container and zoom or rotate it. Unfortunately that means these subpixel gaps between bars return, as it was only crispEdges that hid them. Not sure that this even has a solution in theory, when you consider the possibility of rotating the vector image on screen.

Should thumbnail be its own component?

... or an option in the plotly-graph component (like the old image server).

So far, I like plotly-thumbnail as it own component where it can easily reuse the plotly-graph methods without polluting them.

The problem is, plotly-thumbnail needs a separate route. So to generate a thumbnail one will now have to make a request to ${IMAGE_SEVER_PORT}/thumbnail. Is that too much of a hassle?

Stay aware of electron chromium update to offer --headless w/o xvfb

Chromium ships with a --headless starting in version 59. Electron 1.8.1 (in pre-release as of 2017/10/11) ships with Chromium 59. So our days of having to use xvfb might be numbered 🎉

But, this won't happen now. I tried [email protected] in this gist, but looks like the --headless option (and additional required flags) aren't compatible with WebGL. If your interested, pull down that gist and run npm start -- gl3d_bunny - you should see electron hanging and failing to generate an image. In contrast, for regular SVG graphs e.g. npm start -- 10, headless seems to work ok.

See electron/electron#228 for more info.

Standalone app logs "Installed ..." on exec

Making an issue out of @n-riesco's #66 (comment):

I've noticed that running the AppImage version now prints out the message:

installed: X-AppImage-BuildId=5a6b0d10-3f0d-11a8-3934-f7a37a902d22 image: X-AppImage-BuildId=5a6b0d10-3f0d-11a8-3934-f7a37a902d22

I don't remember this happening before.

Pipe example hanging on OS X

The help info for orca graph --help displays this usage example:

 $ cat plot.json | orca graph {options} > plot.png

However, when I try to use this (on OS X) the command just hangs

echo '{"data": [{"y": [2, 3, 1]}]}' > plot.json
cat plot.json | orca graph > plot.png

For background, I was considering using a STDIN approach for the plotly.py integration because there's a limit to how large command-line arguments can be. For example, the Python approach in the README, of passing the JSON definition of the graph as an argument to orca, fails for a scatter plot with 100,000 points. cc @chriddyp

`Orca` does not work on Windows

I want to use orca() through package plotly in R. I installed orca on Windows 10 following the instructions:

All the commands I describe next were called from Command Prompt, not from R.
Command orca did not work. Thus I added C:\Users\my_pc\AppData\Local\Programs\orca\orca.exe to the path manually. Now if I write C:\Users\my_pc\AppData\Local\Programs\orca\orca.exe in the prompt, it works. But writing command orca doesn't. By writing PATH I see that the last element is the path to orca.exe.

What should I do next to make orca work?

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.