Skip to content

BackslashPlugin.session_start() will report the session only if it wasn't reported already (fix #72) #75

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 7, 2018
Merged
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
35 changes: 18 additions & 17 deletions backslash/contrib/slash_plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -133,8 +133,7 @@ def deactivate(self):
self._keepalive_thread.stop()
super(BackslashPlugin, self).deactivate()

@handle_exceptions
def session_start(self):
def _notify_session_start(self):
metadata = self._get_initial_session_metadata()
is_parent_session = False
parent_logical_id = child_id = None
Expand All @@ -146,21 +145,18 @@ def session_start(self):
else:
is_parent_session = True

try:
self.session = self.client.report_session_start(
logical_id=slash.context.session.id,
parent_logical_id=parent_logical_id,
is_parent_session=is_parent_session,
child_id=child_id,
total_num_tests=slash.context.session.get_total_num_tests(),
hostname=socket.getfqdn(),
keepalive_interval=self._keepalive_interval,
infrastructure='slash',
metadata=metadata,
**self._get_extra_session_start_kwargs()
)
except Exception: # pylint: disable=broad-except
raise
self.session = self.client.report_session_start(
logical_id=slash.context.session.id,
parent_logical_id=parent_logical_id,
is_parent_session=is_parent_session,
child_id=child_id,
total_num_tests=slash.context.session.get_total_num_tests(),
hostname=socket.getfqdn(),
keepalive_interval=self._keepalive_interval,
infrastructure='slash',
metadata=metadata,
**self._get_extra_session_start_kwargs()
)

for label in self.current_config.session_labels:
self.client.api.call.add_label(session_id=self.session.id, label=label)
Expand All @@ -174,6 +170,11 @@ def session_start(self):
)
self._keepalive_thread.start()

@handle_exceptions
def session_start(self):
if self.session is None:
self._notify_session_start()

def _get_initial_session_metadata(self):
returned = {
'slash::version': slash.__version__,
Expand Down