cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Check out the JMP® Marketplace featured Capability Explorer add-in
Choose Language Hide Translation Bar
lala
Level VIII

Questions about "Multi HTTP Request" of JMP17?

Hello!

JMP17 added "Multi HTTP Request"
Sample code: Do the three download tasks download at the same time, or do the next tasks download when one is complete?
Will the overall download time be reduced by using this feature?

urls =
{"http://cdimage.ubuntu.com/lubuntu/releases/20.04.3/release/lubuntu-20.04.3-desktop-amd64.iso",
"http://downloads.sourceforge.net/clonezilla/clonezilla-live-2.7.3-19-amd64.iso",
"https://download.manjaro.org/xfce/21.1.0/manjaro-xfce-21.1.0-210817-linux513.iso"};

requests = New Multi HTTP Request();
For( i = 1, i <= N Items( urls ), i++,
	request = New HTTP Request( Method( "GET" ), URL( urls[i] ) );
	requests << Add( request );
);
http_requests = requests << Get Requests();
data = requests << Download( "show progress", "detailed" );
Show( requests << Has Error );
For( i = 1, i <= N Items( http_requests ), i++,
	Show( http_requests[i] << Get Mime Type() )
);
5 REPLIES 5

Re: Questions about "Multi HTTP Request" of JMP17?

They happen at the same time.

So the time it takes for it to finish is longest time of the 3.

If first iso takes 2 minutes, the second 1 minute and the 3rd 3 minutes, then the total time to for HTTP Request to download is 3 minutes.

lala
Level VIII

Re: Questions about "Multi HTTP Request" of JMP17?

How can this form of circular download be modified to parallel download?
The original code was to download the data in the same format on different dates, and merge it into the first table on each download.


Now can you download it side-by-side as Multi HTTP Request of JMP17, but finally merge it into a data table

urls = {};
j = 1;
dt = Current Data Table();
m = 0;
For( j = 1, j <= N Row( dt ), j++,
	a = Char( dt[j, "date"] );
	u = "http://dd.gubit.xx/longhubang/?t=-1&date=" || a || "&page=1";
	Insert Into( urls, u );
);

requests = New Multi HTTP Request();
For( i = 1, i <= N Items( urls ), i++, 

	d1 = Open( urls[i], HTML Table( 1, Column Names( 1 ), Data Starts( 2 ) ) );
	
	requests << Add( d1 );//??
);
http_requests = requests << Get Requests();
lala
Level VIII

Re: Questions about "Multi HTTP Request" of JMP17?

  • The picture is too big? Cannot upload as a texture.

  • The original loop mode of the code

dt = Current Data Table(); m=0;
For( j = 1, j <= N Row( dt ), j++,
	a = Char( dt[j, "date"] );
	u = "http://dd.gubit.xx/longhubang/?t=-1&date=" || a || "&page=1";
	d1 = Open( u, HTML Table( 1, Column Names( 1 ), Data Starts( 3 ) ) );
	Current Data Table( d1 );
	New Column( "date" );
	d1[1 :: N Row( d1 ), "date"] = Num( a );
	m = m + 1;
	If( m == 1,
		d2 = d1;
		d2 << setName( "dt2" );
	,
		Current Data Table( d2 );
		d2 << Concatenate( Data Table( d1 ), Append to first table );
		Close( d1, nosave );
	);
);

Thanks!

lala
Level VIII

Re: Questions about "Multi HTTP Request" of JMP17?

Thanks Experts!

Re: Questions about "Multi HTTP Request" of JMP17?

For the MultiHTTPRequest part of your question, you probably want:

 

data = requests << Send();

instead of:

 

 

http_requests = requests << Get Requests();

 

 

data = requests << Send() sends the requests to the web service and returns a list of responses.

data = requests << Send();
For(I = 1, I <= N Items(data), I++,
//data[I] corresponds to the return value of request[I]
);