diff --git a/.github/workflows/coopr_tests.yml b/.github/workflows/coopr_tests.yml index 3dbc6cc7..9f2fddce 100644 --- a/.github/workflows/coopr_tests.yml +++ b/.github/workflows/coopr_tests.yml @@ -7,23 +7,13 @@ on: push: branches: - '**' - workflow_dispatch: jobs: - run-tasks: + build-and-test: if: ${{ github.event_name == 'push' && contains(github.event.head_commit.message, 'coopr') || github.event_name == 'pull_request' }} runs-on: self-hosted - steps: - - name: Checkout repository - uses: actions/checkout@v3 - - build-docker: - if: ${{ github.event_name == 'push' && contains(github.event.head_commit.message, 'coopr') || github.event_name == 'pull_request' }} - runs-on: self-hosted - needs: run-tasks - steps: - name: Checkout repository uses: actions/checkout@v3 @@ -50,31 +40,11 @@ jobs: cd /home/stefan/expectedparrot/coopr docker-compose build --no-cache backend && docker-compose up --wait - run-make-coop-test: - if: ${{ github.event_name == 'push' && contains(github.event.head_commit.message, 'coopr') || github.event_name == 'pull_request' }} - runs-on: self-hosted - needs: build-docker - - steps: - - name: Checkout repository - uses: actions/checkout@v3 - - - name: Determine last commit hash for EDSL - id: get_edsl_commit - run: | - if [ "${{ github.head_ref }}" != "" ]; then - # Pull Request: Get the last commit from the source branch - echo "EDSL_COMMIT=$(git rev-parse ${{ github.event.pull_request.head.sha }})" >> $GITHUB_ENV - else - # Push: Get the last commit directly - echo "EDSL_COMMIT=$(git rev-parse HEAD)" >> $GITHUB_ENV - fi - - name: Fetch and checkout last commit in EDSL run: | cd /home/stefan/expectedparrot/edsl git fetch origin - git checkout -f $EDSL_COMMIT || git checkout -f origin/main # Fallback to main if commit is unavailable + git checkout -f $COMMIT || git checkout -f origin/main # Fallback to main if commit is unavailable - name: Run make coop-test run: | diff --git a/edsl/coop/coop.py b/edsl/coop/coop.py index 0bd22d6c..911fa63a 100644 --- a/edsl/coop/coop.py +++ b/edsl/coop/coop.py @@ -111,13 +111,13 @@ def _send_server_request( url = f"{self.api_url}/{uri}" method = method.upper() if payload is None: - timeout = 20 + timeout = 40 elif ( method.upper() == "POST" and "json_string" in payload and payload.get("json_string") is not None ): - timeout = max(20, (len(payload.get("json_string", "")) // (1024 * 1024))) + timeout = max(40, (len(payload.get("json_string", "")) // (1024 * 1024))) try: if method in ["GET", "DELETE"]: response = requests.request( @@ -533,6 +533,7 @@ def remote_cache_create_many( uri="api/v0/remote-cache/many", method="POST", payload=payload, + timeout=40, ) self._resolve_server_response(response) response_json = response.json() @@ -563,6 +564,7 @@ def remote_cache_get( uri="api/v0/remote-cache/get-many", method="POST", payload={"keys": exclude_keys}, + timeout=40, ) self._resolve_server_response(response) return [ @@ -581,6 +583,7 @@ def remote_cache_get_diff( uri="api/v0/remote-cache/get-diff", method="POST", payload={"keys": client_cacheentry_keys}, + timeout=40, ) self._resolve_server_response(response) response_json = response.json() diff --git a/edsl/results/Results.py b/edsl/results/Results.py index 38fb4dc8..5cfce805 100644 --- a/edsl/results/Results.py +++ b/edsl/results/Results.py @@ -170,12 +170,12 @@ def compute_job_cost(self, include_cached_responses_in_cost: bool = False) -> fl """ total_cost = 0 for result in self: - for key in result.raw_model_response: + for key in result["raw_model_response"]: if key.endswith("_cost"): - result_cost = result.raw_model_response[key] + result_cost = result["raw_model_response"][key] question_name = key.removesuffix("_cost") - cache_used = result.cache_used_dict[question_name] + cache_used = result["cache_used_dict"][question_name] if isinstance(result_cost, (int, float)): if include_cached_responses_in_cost: