Skip to content

Waiting for test-run completion#3

Merged
srautiai merged 3 commits into
bitbar:masterfrom
remster:add_waiting_for_run_completion
Dec 10, 2014
Merged

Waiting for test-run completion#3
srautiai merged 3 commits into
bitbar:masterfrom
remster:add_waiting_for_run_completion

Conversation

@remster
Copy link
Copy Markdown

@remster remster commented Dec 5, 2014

It's difficult to use the python client for test-run completion.
One needs to write a bash script that parses the stdout coming out from various commands:

  • the one that schedules the job (to extract the job id)
  • one that enquires the state of the job (to extract its status)
    This cannot be done with python if only, because start_test_run does not return the job id (it only prints it out).
    Since anyone using this client will be interested in knowing when the job is finished, i thought I propose to enable it at the very root and propose this change.

Comment thread testdroid/__init__.py
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should not happen as self.get_token() is called before each HTTP request, and get_token uses refresh token to retrieve a new token if the current one is expired. The expiration time for refresh token in our backend is currently 3600seconds so if the access token is expired the new access token is retrieved:
https://github.com/bitbar/testdroid-api-client-python/blob/master/testdroid/__init__.py#L130

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for your comment.
I have added the workaround because i saw (and quoted) token expiry error triggering despite this line:
https://github.com/bitbar/testdroid-api-client-python/blob/master/testdroid/__init__.py#L130
In other words: what you say should happen, isn't happening. I urge you to comment out the workaround and see for yourself. You need a relatively long-running job.

Note that I have now added an additional commit (added the result download function)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, I think that there is two cases(at least) when this could happen:

  1. Backend has lost all the tokens during server update/restart (
  2. Another api client has already request a new token using refresh token(frontend is currently using the same token so it might have requested a new token when python client is still trying using the old one)

Otherwise the script output needs parsing.
srautiai pushed a commit that referenced this pull request Dec 10, 2014
@srautiai srautiai merged commit a420d04 into bitbar:master Dec 10, 2014
spedepekka pushed a commit to spedepekka/testdroid-api-client-python that referenced this pull request Feb 5, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants