Re: REST api: how to upload jar?

2017-12-11 Thread Piotr Nowojski
Hi,

Have you tried this

https://stackoverflow.com/questions/41724269/apache-flink-rest-client-jar-upload-not-working
 


?

Piotrek

> On 11 Dec 2017, at 14:22, Edward  wrote:
> 
> Let me try that again -- it didn't seem to render my commands correctly:
> 
> Thanks for the response, Shailesh. However, when I try with python, I get
> the 
> same error as when I attempted this with cURL: 
> 
> $ python uploadJar.py
> java.io.FileNotFoundException:
> /tmp/flink-web-4bed7801-fa5e-4e5e-abf1-3fa13ba1f528/438eaac1-7647-4716-8d8d-f95acd8129b2_/path/to/jar/file.jar
> (No such file or directory)
> 
> That is, if I tell python (or cURL) that my jar file is at 
> /path/to/jar/file.jar, the file path it uses on the server side includes 
> that entire path in the target file name. And if I try the script with no
> path (i.e. run the script 
> in the folder where file.jar exists), it uploads an empty file named 
> file.jar.  The endpoint at file/upload seems to be take the form-data 
> element "jarfile" and use the fully qualified path when trying to save the 
> jar file on the server side. 
> 
> Here is my equivalent attempt using cURL, which gives the same 
> FileNoFoundException as above: 
> 
> curl 'http://localhost:8081/jars/upload' -H 'Content-Type:
> multipart/form-data; boundary=Boundary' --data-binary
> $'--Boundary\r\nContent-Disposition: form-data; name="jarfile";
> filename="/path/to/jar/file.jar"\r\nContent-Type:
> application/java-archive\r\n\r\n\r\n--Boundary--\r\n' 
> 
> 
> 
> 
> --
> Sent from: 
> http://apache-flink-user-mailing-list-archive.2336050.n4.nabble.com/



Re: REST api: how to upload jar?

2017-12-11 Thread Edward
Let me try that again -- it didn't seem to render my commands correctly:

Thanks for the response, Shailesh. However, when I try with python, I get
the 
same error as when I attempted this with cURL: 

$ python uploadJar.py
java.io.FileNotFoundException:
/tmp/flink-web-4bed7801-fa5e-4e5e-abf1-3fa13ba1f528/438eaac1-7647-4716-8d8d-f95acd8129b2_/path/to/jar/file.jar
(No such file or directory)

That is, if I tell python (or cURL) that my jar file is at 
/path/to/jar/file.jar, the file path it uses on the server side includes 
that entire path in the target file name. And if I try the script with no
path (i.e. run the script 
in the folder where file.jar exists), it uploads an empty file named 
file.jar.  The endpoint at file/upload seems to be take the form-data 
element "jarfile" and use the fully qualified path when trying to save the 
jar file on the server side. 

Here is my equivalent attempt using cURL, which gives the same 
FileNoFoundException as above: 

curl 'http://localhost:8081/jars/upload' -H 'Content-Type:
multipart/form-data; boundary=Boundary' --data-binary
$'--Boundary\r\nContent-Disposition: form-data; name="jarfile";
filename="/path/to/jar/file.jar"\r\nContent-Type:
application/java-archive\r\n\r\n\r\n--Boundary--\r\n' 




--
Sent from: http://apache-flink-user-mailing-list-archive.2336050.n4.nabble.com/


Re: REST api: how to upload jar?

2017-12-11 Thread Edward
Thanks for the response, Shailesh. However, when I try with python, I get the
same error as when I attempted this with cURL:


That is, if I tell python (or cURL) that my jar file is at
/path/to/jar/file.jar, the file path it uses on the server side includes
that entire path. And if I try the script with no path (i.e. run the script
in the folder where file.jar exists), it uploads an empty file named
file.jar.  The endpoint at file/upload seems to be take the form-data
element "jarfile" and use the fully qualified path when trying to save the
jar file on the server side.

Here is my equivalent attempt using cURL, which gives the same
FileNoFoundException as above:




--
Sent from: http://apache-flink-user-mailing-list-archive.2336050.n4.nabble.com/


Re: REST api: how to upload jar?

2017-12-10 Thread Shailesh Jain
If you have python available, a simple script can help you there.

uploadJar.py:

> import requests # you might need to 'pip install requests' from command
> line
>
> uploadUrl = 'http://localhost:8081/jars/upload' # Replace localhost with
> your JobManager url
> jarName = '/path/to/jar/file.jar'
> files = {'file': (jarName, open(jarName, 'rb'),
> 'application/x-java-archive')}
> res = requests.post(uploadUrl, files=files)
> print res.json()
>

You can run this script by running "python uploadJar.py" from command line.

Hope it helps!
Shailesh

On Fri, Dec 8, 2017 at 9:40 PM, Edward  wrote:

> Has anyone successfully uploaded to the REST API using command line tools
> (i.e. curl)? If so, please post an example.
>
>
>
> --
> Sent from: http://apache-flink-user-mailing-list-archive.2336050.
> n4.nabble.com/
>


Re: REST api: how to upload jar?

2017-12-08 Thread Edward
Has anyone successfully uploaded to the REST API using command line tools
(i.e. curl)? If so, please post an example.



--
Sent from: http://apache-flink-user-mailing-list-archive.2336050.n4.nabble.com/


Re: REST api: how to upload jar?

2017-01-25 Thread Cliff Resnick
Thanks for that, issue here https://issues.apache.org/jira/browse/FLINK-5646

On Tue, Jan 24, 2017 at 11:30 PM, Sachin Goel 
wrote:

> Hey Cliff
> You can upload a jar file using http post with the file data sent under a
> form field 'jarfile'.
>
> Can you also please open a jira for fixing the documentation?
>
> - Sachin
>
>
> On Jan 25, 2017 06:55, "Cliff Resnick"  wrote:
>
>> The 1.2 release documentation (https://ci.apache.org/project
>> s/flink/flink-docs-release-1.2/monitoring/rest_api.html)  states "It is
>> possible to upload, run, and list Flink programs via the REST APIs and web
>> frontend". However there is no documentation about uploading a jar via REST
>> api. Does this mean that upload is only supported via the web frontend?  I
>> did notice that if I manually upload a jar to the configured upload dir an
>> prepend its name with a uuid it does get recognized and I can POST a job
>> start, but this is messy and I'd rather use the api if supported.
>>
>> -Cliff
>>
>


Re: REST api: how to upload jar?

2017-01-24 Thread Sachin Goel
Hey Cliff
You can upload a jar file using http post with the file data sent under a
form field 'jarfile'.

Can you also please open a jira for fixing the documentation?

- Sachin


On Jan 25, 2017 06:55, "Cliff Resnick"  wrote:

> The 1.2 release documentation (https://ci.apache.org/project
> s/flink/flink-docs-release-1.2/monitoring/rest_api.html)  states "It is
> possible to upload, run, and list Flink programs via the REST APIs and web
> frontend". However there is no documentation about uploading a jar via REST
> api. Does this mean that upload is only supported via the web frontend?  I
> did notice that if I manually upload a jar to the configured upload dir an
> prepend its name with a uuid it does get recognized and I can POST a job
> start, but this is messy and I'd rather use the api if supported.
>
> -Cliff
>


REST api: how to upload jar?

2017-01-24 Thread Cliff Resnick
The 1.2 release documentation (https://ci.apache.org/
projects/flink/flink-docs-release-1.2/monitoring/rest_api.html)  states "It
is possible to upload, run, and list Flink programs via the REST APIs and
web frontend". However there is no documentation about uploading a jar via
REST api. Does this mean that upload is only supported via the web
frontend?  I did notice that if I manually upload a jar to the configured
upload dir an prepend its name with a uuid it does get recognized and I can
POST a job start, but this is messy and I'd rather use the api if supported.

-Cliff