Skip to content

Commit 6a50756

Browse files
committed
Merge branch 'dev' into Study-to-multi-eval
2 parents bd12318 + a7d6467 commit 6a50756

File tree

4 files changed

+138
-8
lines changed

4 files changed

+138
-8
lines changed

.github/workflows/pypi.yml

Lines changed: 125 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,125 @@
1+
name: Build and Publish
2+
# based on official doc
3+
# https://packaging.python.org/en/latest/guides/publishing-package-distribution-releases-using-github-actions-ci-cd-workflows/
4+
5+
on: [push, workflow_dispatch]
6+
7+
jobs:
8+
build:
9+
name: Build
10+
runs-on: ubuntu-22.04
11+
12+
steps:
13+
- uses: actions/checkout@v4
14+
15+
- name: Set up Python
16+
uses: actions/setup-python@v5
17+
with:
18+
python-version: "3.x"
19+
20+
- name: Install pypa/build
21+
run: python3 -m pip install build --user
22+
23+
- name: Build a binary wheel and a source tarball (agentlab)
24+
run: python3 -m build . --outdir dist/
25+
26+
- name: Store the distribution packages
27+
uses: actions/upload-artifact@v4
28+
with:
29+
name: python-package-distributions
30+
path: dist/
31+
32+
publish-to-pypi:
33+
name: Publish to PyPI
34+
if: startsWith(github.ref, 'refs/tags/') # only publish to PyPI on tag pushes # tweak so it doesnt publish all tags
35+
needs:
36+
- build
37+
runs-on: ubuntu-22.04
38+
environment: pypi
39+
permissions:
40+
id-token: write # IMPORTANT: mandatory for trusted publishing
41+
42+
steps:
43+
- name: Download all the distribution packages
44+
uses: actions/download-artifact@v4
45+
with:
46+
name: python-package-distributions
47+
path: dist/
48+
49+
- name: Publish all distribution packages to PyPI
50+
uses: pypa/gh-action-pypi-publish@release/v1
51+
52+
github-release:
53+
name: Sign packages with Sigstore and upload them to GitHub Release
54+
needs:
55+
- publish-to-pypi
56+
runs-on: ubuntu-22.04
57+
58+
permissions:
59+
contents: write # IMPORTANT: mandatory for making GitHub Releases
60+
id-token: write # IMPORTANT: mandatory for sigstore
61+
62+
steps:
63+
- name: Download all the dists
64+
uses: actions/download-artifact@v4
65+
with:
66+
name: python-package-distributions
67+
path: dist/
68+
69+
- name: Sign the dists with Sigstore
70+
uses: sigstore/[email protected]
71+
with:
72+
inputs: >-
73+
./dist/*.tar.gz
74+
./dist/*.whl
75+
76+
- name: Create GitHub Release
77+
env:
78+
GITHUB_TOKEN: ${{ github.token }}
79+
run: >-
80+
gh release create
81+
'${{ github.ref_name }}'
82+
--repo '${{ github.repository }}'
83+
--notes ""
84+
85+
- name: Upload artifact signatures to GitHub Release
86+
env:
87+
GITHUB_TOKEN: ${{ github.token }}
88+
# Upload to GitHub Release using the `gh` CLI.
89+
# `dist/` contains the built packages, and the
90+
# sigstore-produced signatures and certificates.
91+
run: >-
92+
gh release upload
93+
'${{ github.ref_name }}' dist/**
94+
--repo '${{ github.repository }}'
95+
96+
- name: Set GitHub Release as pre-release
97+
if: contains(github.ref, '.dev') # only set tags vA.B.C.devD as pre-release
98+
env:
99+
GITHUB_TOKEN: ${{ github.token }}
100+
run: >-
101+
gh release edit
102+
'${{ github.ref_name }}'
103+
--repo '${{ github.repository }}'
104+
--prerelease
105+
106+
# publish-to-testpypi:
107+
# name: Publish to TestPyPI
108+
# needs:
109+
# - build
110+
# runs-on: ubuntu-latest
111+
# environment: testpypi
112+
# permissions:
113+
# id-token: write # IMPORTANT: mandatory for trusted publishing
114+
115+
# steps:
116+
# - name: Download all the distribution packages
117+
# uses: actions/download-artifact@v4
118+
# with:
119+
# name: python-package-distributions
120+
# path: dist/
121+
122+
# - name: Publish distribution packages to TestPyPI
123+
# uses: pypa/gh-action-pypi-publish@release/v1
124+
# with:
125+
# repository-url: https://test.pypi.org/legacy/

src/agentlab/experiments/exp_utils.py

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
1-
import os
2-
from pathlib import Path
3-
from browsergym.experiments.loop import _move_old_exp, yield_all_exp_results
4-
from tqdm import tqdm
51
import logging
6-
from browsergym.experiments.loop import ExpArgs
7-
from contextlib import contextmanager
2+
import os
83
import signal
94
import sys
10-
from time import time, sleep
5+
from contextlib import contextmanager
6+
from pathlib import Path
7+
from time import sleep, time
8+
9+
from browsergym.experiments.loop import ExpArgs, _move_old_exp, yield_all_exp_results
10+
from tqdm import tqdm
1111

1212
logger = logging.getLogger(__name__) # Get logger based on module name
1313

@@ -130,6 +130,7 @@ def add_dependencies(exp_args_list: list[ExpArgs], task_dependencies: dict[str,
130130
class MockedExpArgs:
131131
def __init__(self, exp_id, depends_on=None):
132132
self.exp_id = exp_id
133+
self.exp_name = f"exp_{exp_id}"
133134
self.depends_on = depends_on if depends_on else []
134135
self.start_time = None
135136
self.end_time = None

src/agentlab/experiments/graph_execution_ray.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ def get_task(exp_arg: bgym.ExpArgs):
2828
dependency_tasks = [get_task(exp_args_map[dep_key]) for dep_key in exp_arg.depends_on]
2929

3030
# Create new task that depends on the dependency results
31-
task_map[exp_arg.exp_id] = run_exp.remote(
31+
task_map[exp_arg.exp_id] = run_exp.options(name=f"{exp_arg.exp_name}").remote(
3232
exp_arg, *dependency_tasks, avg_step_timeout=avg_step_timeout
3333
)
3434
return task_map[exp_arg.exp_id]

src/agentlab/ui_assistant.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
from browsergym.experiments.loop import EnvArgs, ExpArgs
44

55
from agentlab.agents.agent_args import AgentArgs
6+
from agentlab.agents.generic_agent.generic_agent import GenericAgentArgs
67
from agentlab.experiments.exp_utils import RESULTS_DIR
78
from agentlab.experiments.launch_exp import import_object
89

@@ -14,6 +15,9 @@ def make_exp_args(agent_args: AgentArgs, start_url="https://www.google.com"):
1415
except AttributeError:
1516
pass
1617

18+
if isinstance(agent_args, GenericAgentArgs):
19+
agent_args.flags.enable_chat = True
20+
1721
exp_args = ExpArgs(
1822
agent_args=agent_args,
1923
env_args=EnvArgs(

0 commit comments

Comments
 (0)