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
2 changes: 1 addition & 1 deletion .github/workflows/semantic-pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,14 @@

jobs:
semantic-pr:
runs-on: ubuntu-20.04
runs-on: ubuntu-latest
timeout-minutes: 1
steps:
- name: Semantic pull-request
uses: amannn/action-semantic-pull-request@v5.5.3
with:
requireScope: false
wip: true
validateSingleCommit: true
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

Check warning

Code scanning / CodeQL

Workflow does not contain permissions Medium

Actions job or workflow does not limit the permissions of the GITHUB_TOKEN. Consider setting an explicit permissions block, using the following as a minimal starting point: {}
2 changes: 1 addition & 1 deletion ai21/clients/common/maestro/run.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ def retrieve(self, run_id: str) -> RunResponse:
pass

@abstractmethod
def _poll_for_status(self, *, run_id: str, poll_interval: float, poll_timeout: float) -> RunResponse:
def poll_for_status(self, *, run_id: str, poll_interval_sec: float, poll_timeout_sec: float) -> RunResponse:
pass

@abstractmethod
Expand Down
20 changes: 11 additions & 9 deletions ai21/clients/studio/resources/maestro/run.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ def retrieve(
) -> RunResponse:
return self._get(path=f"/{self._module_name}/{run_id}", response_cls=RunResponse)

def _poll_for_status(self, *, run_id: str, poll_interval: float, poll_timeout: float) -> RunResponse:
def poll_for_status(self, *, run_id: str, poll_interval_sec: float, poll_timeout_sec: float) -> RunResponse:
start_time = time.time()

while True:
Expand All @@ -62,10 +62,10 @@ def _poll_for_status(self, *, run_id: str, poll_interval: float, poll_timeout: f
if run.status in TERMINATED_RUN_STATUSES:
return run

if (time.time() - start_time) >= poll_timeout:
if (time.time() - start_time) >= poll_timeout_sec:
return run

time.sleep(poll_interval)
time.sleep(poll_interval_sec)

def create_and_poll(
self,
Expand All @@ -92,7 +92,9 @@ def create_and_poll(
**kwargs,
)

return self._poll_for_status(run_id=run.id, poll_interval=poll_interval_sec, poll_timeout=poll_timeout_sec)
return self.poll_for_status(
run_id=run.id, poll_interval_sec=poll_interval_sec, poll_timeout_sec=poll_timeout_sec
)


class AsyncMaestroRun(AsyncStudioResource, BaseMaestroRun):
Expand Down Expand Up @@ -127,7 +129,7 @@ async def retrieve(
) -> RunResponse:
return await self._get(path=f"/{self._module_name}/{run_id}", response_cls=RunResponse)

async def _poll_for_status(self, *, run_id: str, poll_interval: float, poll_timeout: float) -> RunResponse:
async def poll_for_status(self, *, run_id: str, poll_interval_sec: float, poll_timeout_sec: float) -> RunResponse:
start_time = time.time()

while True:
Expand All @@ -136,10 +138,10 @@ async def _poll_for_status(self, *, run_id: str, poll_interval: float, poll_time
if run.status in TERMINATED_RUN_STATUSES:
return run

if (time.time() - start_time) >= poll_timeout:
if (time.time() - start_time) >= poll_timeout_sec:
return run

await asyncio.sleep(poll_interval)
await asyncio.sleep(poll_interval_sec)

async def create_and_poll(
self,
Expand All @@ -166,6 +168,6 @@ async def create_and_poll(
**kwargs,
)

return await self._poll_for_status(
run_id=run.id, poll_interval=poll_interval_sec, poll_timeout=poll_timeout_sec
return await self.poll_for_status(
run_id=run.id, poll_interval_sec=poll_interval_sec, poll_timeout_sec=poll_timeout_sec
)
Loading