RequestsLibrary support parallel execute suites with pabot?











up vote
0
down vote

favorite












My project using RequestsLibrary to do interface automation, and all interface calls share a session, which is the session generated by the [Create Session] function.



On this basic, we want to do concurrency, using pabot, and the way we want to use is: all multi-threads share a session for concurrency, so the [Create Session] function is currently called only once, and then all threads share the session.



The session can be retrieved from multithreads in my test , but when the interface is invoked, it is found that other thread interface requests fail:



error messages:



KEYWORD RequestsLibrary . Get Request ${agent.session}, ${uri}, headers=${header}, timeout=${timeout}
Documentation:
Send a GET request on the session object found using the

Start / End / Elapsed: 20181109 15:06:36.520 / 20181109 15:06:36.523 / 00:00:00.003
15:06:36.523 FAIL Non-existing index or alias 'adminsession'.


So I would like to ask if we support concurrent scenarios?










share|improve this question






















  • Do you have a Minimal, Complete, and Verifiable example for the observed result. Right now there is quite a bit of room for interpretation that a good robot and pabot example would help clarify.
    – A. Kootstra
    Nov 9 at 8:32










  • @A. Kootstra I submitted a code using request and pabot https://github.com/Huanxin-leolil/request_pabot , when I execute pabot.bat --pabotlib --processes 2 C:Usersleogitrequest_pabot. One of the threads failed to execute ERROR MESSAGE: Non-existing index or alias 'github'.
    – leoli
    Nov 11 at 5:10

















up vote
0
down vote

favorite












My project using RequestsLibrary to do interface automation, and all interface calls share a session, which is the session generated by the [Create Session] function.



On this basic, we want to do concurrency, using pabot, and the way we want to use is: all multi-threads share a session for concurrency, so the [Create Session] function is currently called only once, and then all threads share the session.



The session can be retrieved from multithreads in my test , but when the interface is invoked, it is found that other thread interface requests fail:



error messages:



KEYWORD RequestsLibrary . Get Request ${agent.session}, ${uri}, headers=${header}, timeout=${timeout}
Documentation:
Send a GET request on the session object found using the

Start / End / Elapsed: 20181109 15:06:36.520 / 20181109 15:06:36.523 / 00:00:00.003
15:06:36.523 FAIL Non-existing index or alias 'adminsession'.


So I would like to ask if we support concurrent scenarios?










share|improve this question






















  • Do you have a Minimal, Complete, and Verifiable example for the observed result. Right now there is quite a bit of room for interpretation that a good robot and pabot example would help clarify.
    – A. Kootstra
    Nov 9 at 8:32










  • @A. Kootstra I submitted a code using request and pabot https://github.com/Huanxin-leolil/request_pabot , when I execute pabot.bat --pabotlib --processes 2 C:Usersleogitrequest_pabot. One of the threads failed to execute ERROR MESSAGE: Non-existing index or alias 'github'.
    – leoli
    Nov 11 at 5:10















up vote
0
down vote

favorite









up vote
0
down vote

favorite











My project using RequestsLibrary to do interface automation, and all interface calls share a session, which is the session generated by the [Create Session] function.



On this basic, we want to do concurrency, using pabot, and the way we want to use is: all multi-threads share a session for concurrency, so the [Create Session] function is currently called only once, and then all threads share the session.



The session can be retrieved from multithreads in my test , but when the interface is invoked, it is found that other thread interface requests fail:



error messages:



KEYWORD RequestsLibrary . Get Request ${agent.session}, ${uri}, headers=${header}, timeout=${timeout}
Documentation:
Send a GET request on the session object found using the

Start / End / Elapsed: 20181109 15:06:36.520 / 20181109 15:06:36.523 / 00:00:00.003
15:06:36.523 FAIL Non-existing index or alias 'adminsession'.


So I would like to ask if we support concurrent scenarios?










share|improve this question













My project using RequestsLibrary to do interface automation, and all interface calls share a session, which is the session generated by the [Create Session] function.



On this basic, we want to do concurrency, using pabot, and the way we want to use is: all multi-threads share a session for concurrency, so the [Create Session] function is currently called only once, and then all threads share the session.



The session can be retrieved from multithreads in my test , but when the interface is invoked, it is found that other thread interface requests fail:



error messages:



KEYWORD RequestsLibrary . Get Request ${agent.session}, ${uri}, headers=${header}, timeout=${timeout}
Documentation:
Send a GET request on the session object found using the

Start / End / Elapsed: 20181109 15:06:36.520 / 20181109 15:06:36.523 / 00:00:00.003
15:06:36.523 FAIL Non-existing index or alias 'adminsession'.


So I would like to ask if we support concurrent scenarios?







python parallel-processing request robotframework






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Nov 9 at 8:23









leoli

32




32












  • Do you have a Minimal, Complete, and Verifiable example for the observed result. Right now there is quite a bit of room for interpretation that a good robot and pabot example would help clarify.
    – A. Kootstra
    Nov 9 at 8:32










  • @A. Kootstra I submitted a code using request and pabot https://github.com/Huanxin-leolil/request_pabot , when I execute pabot.bat --pabotlib --processes 2 C:Usersleogitrequest_pabot. One of the threads failed to execute ERROR MESSAGE: Non-existing index or alias 'github'.
    – leoli
    Nov 11 at 5:10




















  • Do you have a Minimal, Complete, and Verifiable example for the observed result. Right now there is quite a bit of room for interpretation that a good robot and pabot example would help clarify.
    – A. Kootstra
    Nov 9 at 8:32










  • @A. Kootstra I submitted a code using request and pabot https://github.com/Huanxin-leolil/request_pabot , when I execute pabot.bat --pabotlib --processes 2 C:Usersleogitrequest_pabot. One of the threads failed to execute ERROR MESSAGE: Non-existing index or alias 'github'.
    – leoli
    Nov 11 at 5:10


















Do you have a Minimal, Complete, and Verifiable example for the observed result. Right now there is quite a bit of room for interpretation that a good robot and pabot example would help clarify.
– A. Kootstra
Nov 9 at 8:32




Do you have a Minimal, Complete, and Verifiable example for the observed result. Right now there is quite a bit of room for interpretation that a good robot and pabot example would help clarify.
– A. Kootstra
Nov 9 at 8:32












@A. Kootstra I submitted a code using request and pabot https://github.com/Huanxin-leolil/request_pabot , when I execute pabot.bat --pabotlib --processes 2 C:Usersleogitrequest_pabot. One of the threads failed to execute ERROR MESSAGE: Non-existing index or alias 'github'.
– leoli
Nov 11 at 5:10






@A. Kootstra I submitted a code using request and pabot https://github.com/Huanxin-leolil/request_pabot , when I execute pabot.bat --pabotlib --processes 2 C:Usersleogitrequest_pabot. One of the threads failed to execute ERROR MESSAGE: Non-existing index or alias 'github'.
– leoli
Nov 11 at 5:10














1 Answer
1






active

oldest

votes

















up vote
1
down vote



accepted










The way that Pabot creates parallel processes is to start multiple independent instances of Robot Framework. In each instance you'll have a separate instantiation of the RequestLibrary. As a consequence of this you'll not be able to share the same session.



Although It is possible to share values from instance to another instance through the pabotlib, this doesn't work for objects. Often an object can be serialized into a string, but sadly the Requests module that RequestsLibrary depends on doesn't support this.



In my view the best approach is to recreate identical sessions across the sessions by reusing the same cookies and other session specific variable via pabotlib.






share|improve this answer





















  • Thanks. I think I agree with your answer. In my project, I tried to create multiple session in multithreading , and all interface use the cookie by reusing the same cookies is works perfectly in request headers. But I need to refactor all my code, It's more hard for me!
    – leoli
    Nov 13 at 4:18











Your Answer






StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");

StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});

function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});


}
});














draft saved

draft discarded


















StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53222111%2frequestslibrary-support-parallel-execute-suites-with-pabot%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown

























1 Answer
1






active

oldest

votes








1 Answer
1






active

oldest

votes









active

oldest

votes






active

oldest

votes








up vote
1
down vote



accepted










The way that Pabot creates parallel processes is to start multiple independent instances of Robot Framework. In each instance you'll have a separate instantiation of the RequestLibrary. As a consequence of this you'll not be able to share the same session.



Although It is possible to share values from instance to another instance through the pabotlib, this doesn't work for objects. Often an object can be serialized into a string, but sadly the Requests module that RequestsLibrary depends on doesn't support this.



In my view the best approach is to recreate identical sessions across the sessions by reusing the same cookies and other session specific variable via pabotlib.






share|improve this answer





















  • Thanks. I think I agree with your answer. In my project, I tried to create multiple session in multithreading , and all interface use the cookie by reusing the same cookies is works perfectly in request headers. But I need to refactor all my code, It's more hard for me!
    – leoli
    Nov 13 at 4:18















up vote
1
down vote



accepted










The way that Pabot creates parallel processes is to start multiple independent instances of Robot Framework. In each instance you'll have a separate instantiation of the RequestLibrary. As a consequence of this you'll not be able to share the same session.



Although It is possible to share values from instance to another instance through the pabotlib, this doesn't work for objects. Often an object can be serialized into a string, but sadly the Requests module that RequestsLibrary depends on doesn't support this.



In my view the best approach is to recreate identical sessions across the sessions by reusing the same cookies and other session specific variable via pabotlib.






share|improve this answer





















  • Thanks. I think I agree with your answer. In my project, I tried to create multiple session in multithreading , and all interface use the cookie by reusing the same cookies is works perfectly in request headers. But I need to refactor all my code, It's more hard for me!
    – leoli
    Nov 13 at 4:18













up vote
1
down vote



accepted







up vote
1
down vote



accepted






The way that Pabot creates parallel processes is to start multiple independent instances of Robot Framework. In each instance you'll have a separate instantiation of the RequestLibrary. As a consequence of this you'll not be able to share the same session.



Although It is possible to share values from instance to another instance through the pabotlib, this doesn't work for objects. Often an object can be serialized into a string, but sadly the Requests module that RequestsLibrary depends on doesn't support this.



In my view the best approach is to recreate identical sessions across the sessions by reusing the same cookies and other session specific variable via pabotlib.






share|improve this answer












The way that Pabot creates parallel processes is to start multiple independent instances of Robot Framework. In each instance you'll have a separate instantiation of the RequestLibrary. As a consequence of this you'll not be able to share the same session.



Although It is possible to share values from instance to another instance through the pabotlib, this doesn't work for objects. Often an object can be serialized into a string, but sadly the Requests module that RequestsLibrary depends on doesn't support this.



In my view the best approach is to recreate identical sessions across the sessions by reusing the same cookies and other session specific variable via pabotlib.







share|improve this answer












share|improve this answer



share|improve this answer










answered Nov 12 at 16:31









A. Kootstra

4,0492932




4,0492932












  • Thanks. I think I agree with your answer. In my project, I tried to create multiple session in multithreading , and all interface use the cookie by reusing the same cookies is works perfectly in request headers. But I need to refactor all my code, It's more hard for me!
    – leoli
    Nov 13 at 4:18


















  • Thanks. I think I agree with your answer. In my project, I tried to create multiple session in multithreading , and all interface use the cookie by reusing the same cookies is works perfectly in request headers. But I need to refactor all my code, It's more hard for me!
    – leoli
    Nov 13 at 4:18
















Thanks. I think I agree with your answer. In my project, I tried to create multiple session in multithreading , and all interface use the cookie by reusing the same cookies is works perfectly in request headers. But I need to refactor all my code, It's more hard for me!
– leoli
Nov 13 at 4:18




Thanks. I think I agree with your answer. In my project, I tried to create multiple session in multithreading , and all interface use the cookie by reusing the same cookies is works perfectly in request headers. But I need to refactor all my code, It's more hard for me!
– leoli
Nov 13 at 4:18


















draft saved

draft discarded




















































Thanks for contributing an answer to Stack Overflow!


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


To learn more, see our tips on writing great answers.





Some of your past answers have not been well-received, and you're in danger of being blocked from answering.


Please pay close attention to the following guidance:


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53222111%2frequestslibrary-support-parallel-execute-suites-with-pabot%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







這個網誌中的熱門文章

Xamarin.form Move up view when keyboard appear

Post-Redirect-Get with Spring WebFlux and Thymeleaf

JBPM : POST request for execute process go wrong