Closed harshpurwar closed 4 months ago
@harshpurwar Can you please provide more detail? What is the error that you're getting when running gclient runhooks
?
Several errors but I think last one is the one that is the crucial one:
________ running 'python3 src/build/util/lastchange.py -o src/build/util/LASTCHANGE' in 'C:\Users\harsh\Upwork\Jack_Parmer_MATLAB_Plotly\Kaleido\repos'
ERROR:root:Failed to get version info: Git command 'git log -1 --format=%H %ct --grep=^Change-Id: HEAD' in C:/Users/harsh/Upwork/Jack_Parmer_MATLAB_Plotly/Kaleido failed: rc=0, stdout='' stderr=''
________ running 'python3 src/build/util/lastchange.py -m GPU_LISTS_VERSION --revision-id-only --header src/gpu/config/gpu_lists_version.h' in 'C:\Users\harsh\Upwork\Jack_Parmer_MATLAB_Plotly\Kaleido\repos'
ERROR:root:Failed to get version info: Git command 'git log -1 --format=%H %ct --grep=^Change-Id: HEAD' in C:/Users/harsh/Upwork/Jack_Parmer_MATLAB_Plotly/Kaleido failed: rc=0, stdout='' stderr=''
I think this is the one that fails and kills gclient runhooks
Error: Command 'python3 src/testing/generate_location_tags.py --out src/testing/location_tags.json' returned non-zero exit status 1 in C:\Users\harsh\Upwork\Jack_Parmer_MATLAB_Plotly\Kaleido\repos
Getting things set up on windows is tricky. You can see the exact config we use in CI in https://github.com/plotly/Kaleido/blob/master/.circleci/config.yml.
That said, if your goal is to use Kaleido from MATLAB you wouldn't need to build the executable from source. You can download the kaleido_win_x64.zip
file from the GitHub releases (https://github.com/plotly/Kaleido/releases/tag/v0.2.1). This is just the executable and is independent of Python. Then you would implement a MATLAB version of https://github.com/plotly/Kaleido/tree/master/repos/kaleido/py. There's a some info on the language wrapper interface in https://github.com/plotly/Kaleido/wiki/Language-Wrapper-Architecture.
Hi @jonmmease
Thank you for your prompt response. I have already tried to use this executable with MATLAB but the issue is that this executable requires interaction after it is launched (read and write) to get its running status, resultant JSON, etc.
However, unlike subprocess.Popen
in python, MATLAB's system
command doesn't have such functionality to constantly read from or write to a background process or system command (Kaleido executable in our case). That's why I wanted to modify Kaleido's C++ code to (a) not keep repeating itself and (b) take input Plotly JSON as a command-line argument and return the resulting image JSON as stdout along with the error, code, etc. like, it does at present. But the process should end after it finishes. I can then capture the output in MATLAB and then use it to write the exported image.
I understand that this won't be ideal and might be slower than usual, but I guess this is the best we can have for the moment. In the future, to make it run faster, we could modify this functionality and provide it with multiple Plotly JSONs (like in an array).
I will try to re-build with exactly the same config as in your circleci config.yml file and get back to you in a day or two.
Although, if you have resources and some time, it would be extremely beneficial for us if you could provide us a similar executable with the said modifications. I am quite new to this and might take a significant time to get this working.
Thank you!
Hi @harshpurwar,
The kaleido executable is set up to accept requests from standard in, and output results to standard out. But it will terminate when the standard-in pipe is closed. If you want to export a single request at a time, you can do that from the command line (on unix) like this:
$ echo '{"layout":{"title":{"text":"Hello Kaleido"}}}' | ./kaleido plotly --no-sandbox
This will output the image export bundle to standard out, and then terminate. Can MATLAB pass a one-time stdin string to a command withsystem
? If not, you could write a thin wrapper shell script that would accept the figure specification as an argument, and then pipe it into the kaleido executable as stdin.
Does that make sense?
Yes, this solves my problem. I can use the same executable like this with MATLAB. Perfect!
Thanks for letting me know.
Thanks for your interest in Kaleido. We are currently working on an overhaul that might address your issue - we hope to have news in a few weeks and will post an update then. Thanks - @gvwilson
I was trying to set this up on my computer and tried to get chromium and build it using the instructions in README. But for some reason, I am not able to set it up that easily.
The one command in this script that fails is the following:
gclient runhooks