Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@
<PropertyGroup>
<HelixPostCommands Condition="$(IsPosixShell)">
$(HelixPostCommands);
/bin/sh $HELIX_CORRELATION_PAYLOAD/reporter/run.sh $(SYSTEM_TEAMFOUNDATIONCOLLECTIONURI) $(SYSTEM_TEAMPROJECT) $(TestRunId) $(SYSTEM_ACCESSTOKEN)
/bin/sh $HELIX_CORRELATION_PAYLOAD/reporter/run.sh $(SYSTEM_TEAMFOUNDATIONCOLLECTIONURI) $(SYSTEM_TEAMPROJECT) $(TestRunId) $(SYSTEM_ACCESSTOKEN) || exit $?
</HelixPostCommands>
<HelixPostCommands Condition="!$(IsPosixShell)">
$(HelixPostCommands);
call %HELIX_CORRELATION_PAYLOAD%\reporter\run.bat $(SYSTEM_TEAMFOUNDATIONCOLLECTIONURI) $(SYSTEM_TEAMPROJECT) $(TestRunId) $(SYSTEM_ACCESSTOKEN)
call %HELIX_CORRELATION_PAYLOAD%\reporter\run.bat $(SYSTEM_TEAMFOUNDATIONCOLLECTIONURI) $(SYSTEM_TEAMPROJECT) $(TestRunId) $(SYSTEM_ACCESSTOKEN) || exit /b
</HelixPostCommands>
</PropertyGroup>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@ GOTO :retryloop

echo %date%-%time%
%ENV_PATH%\Scripts\python.exe -B %~dp0run.py %*
set _uploaderExitCode=%ERRORLEVEL%
echo %date%-%time%

set PYTHONPATH=%_OLD_PYTHONPATH%
exit /b %_uploaderExitCode%
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,16 @@
import traceback
import logging
from queue import Queue
from threading import Thread
from threading import Thread, Lock
from typing import Tuple, Optional

from test_results_reader import read_results
from helpers import batch, get_env
from azure_devops_result_publisher import AzureDevOpsTestResultPublisher

workerFailedLock = Lock()
workerFailed = False

class UploadWorker(Thread):
def __init__(self, queue, idx, collection_uri, team_project, test_run_id, access_token):
super(UploadWorker, self).__init__()
Expand All @@ -33,13 +36,16 @@ def __process(self, batch):
self.__print('uploaded {} results'.format(self.total_uploaded))

def run(self):
global workerFailed, workerFailedLock
self.__print("starting...")
while True:
try:
item = self.queue.get()
self.__process(item)
except:
self.__print("got error: {}".format(traceback.format_exc()))
with workerFailedLock:
workerFailed = True
finally:
self.queue.task_done()

Expand All @@ -65,6 +71,7 @@ def process_args() -> Tuple[str, str, str, Optional[str]]:


def main():
global workerFailed, workerFailedLock
logging.basicConfig(
format='%(asctime)s: %(levelname)s: %(thread)d: %(module)s(%(lineno)d): %(funcName)s: %(message)s',
level=logging.INFO,
Expand Down Expand Up @@ -105,6 +112,10 @@ def main():
q.join()

log.info("Main thread exiting")

with workerFailedLock:
if workerFailed:
sys.exit(1337)

if __name__ == '__main__':
main()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@ fi

date -u +"%FT%TZ"
$ENV_PATH/bin/python -B $script_path/run.py "$@"
export _uploaderExitCode=$?
date -u +"%FT%TZ"

export PYTHONPATH=$_OLD_PYTHONPATH
export PYTHONPATH=$_OLD_PYTHONPATH
exit $_uploaderExitCode