Skip to content

Commit

Permalink
Add review_requested as a trigger & increased timeouts for camoufla…
Browse files Browse the repository at this point in the history
…ge (#1200)

* Set the status to Review - Ready for Review when a review is manually requested. (from @jarmak-nv  #1191 )
* Increase timeouts for camouflage

Closes #1190

## By Submitting this PR I confirm:
- I am familiar with the [Contributing Guidelines](https://github.com/nv-morpheus/Morpheus/blob/main/docs/source/developer_guide/contributing.md).
- When the PR is ready for review, new or existing tests cover these changes.
- When the PR is ready for review, the documentation is up to date with these changes.

Authors:
  - David Gardner (https://github.com/dagardner-nv)
  - Ben Jarmak (https://github.com/jarmak-nv)

Approvers:
  - Michael Demoret (https://github.com/mdemoret-nv)

URL: #1200
  • Loading branch information
dagardner-nv authored Sep 19, 2023
1 parent 9174cec commit 3d9020d
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 8 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/project_automation_set_in_review.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ on:
pull_request_target:
# Run this action when a PR is opened or edited
# Issues do not have a graphQL connection to linked PRs so we can't use that event
types: [ready_for_review]
types: [ready_for_review, review_requested]

env:
ORG: ${{ github.event.repository.owner.login }}
Expand Down
19 changes: 12 additions & 7 deletions tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -517,7 +517,7 @@ def disable_gc():
gc.enable()


def wait_for_camouflage(host="localhost", port=8000, timeout=5):
def wait_for_camouflage(host="localhost", port=8000, timeout=10):

start_time = time.time()
cur_time = start_time
Expand All @@ -526,7 +526,7 @@ def wait_for_camouflage(host="localhost", port=8000, timeout=5):
url = f"http://{host}:{port}/ping"

while cur_time - start_time <= timeout:
timeout_epoch = min(cur_time + 1.0, end_time)
timeout_epoch = min(cur_time + 2.0, end_time)

try:
request_timeout = max(timeout_epoch - cur_time, 0.1)
Expand Down Expand Up @@ -568,7 +568,7 @@ def _start_camouflage(root_dir: str,
host: str = "localhost",
port: int = 8000) -> typing.Tuple[bool, typing.Optional[subprocess.Popen]]:
logger = logging.getLogger(f"morpheus.{__name__}")
startup_timeout = 5
startup_timeout = 10

launch_camouflage = os.environ.get('MORPHEUS_NO_LAUNCH_CAMOUFLAGE') is None
is_running = False
Expand Down Expand Up @@ -596,14 +596,19 @@ def _start_camouflage(root_dir: str,

logger.info("Launched camouflage in %s with pid: %s", root_dir, popen.pid)

def read_logs():
camouflage_log = os.path.join(root_dir, 'camouflage.log')
if os.path.exists(camouflage_log):
with open(camouflage_log, 'r', encoding='utf-8') as f:
return f.read()
return ""

if not wait_for_camouflage(host=host, port=port, timeout=startup_timeout):

if popen.poll() is not None:
camouflage_log = os.path.join(root_dir, 'camouflage.log')
raise RuntimeError(
f"camouflage server exited with status code={popen.poll()} details in: {camouflage_log}")
raise RuntimeError(f"camouflage server exited with status code={popen.poll()}\n{read_logs()}")

raise RuntimeError("Failed to launch camouflage server")
raise RuntimeError(f"Failed to launch camouflage server\n{read_logs()}")

# Must have been started by this point
return (True, popen)
Expand Down

0 comments on commit 3d9020d

Please sign in to comment.