Skip to content

Wire JATOS pull to pbsjatos via env - #110

Open
bahaaaldin214 wants to merge 3 commits into
mainfrom
fix/jatos-pbsjatos-env
Open

Wire JATOS pull to pbsjatos via env#110
bahaaaldin214 wants to merge 3 commits into
mainfrom
fix/jatos-pbsjatos-env

Conversation

@bahaaaldin214

Copy link
Copy Markdown
Contributor

Summary

  • Replace hardcoded old jatos.psychology.uiowa.edu URLs in pull_handler.py with JATOS_BASE_URL (default https://pbsjatos.psychology.uiowa.edu).
  • Read JATOS_TOKEN from env in main_handler.py (remove inline token).
  • Pass JATOS_TOKEN / JATOS_BASE_URL (and optional TEASE) into the Boost CA nightly workflow.

Why

Nightly Boost CA still hits the retired JATOS host and times out. Lab moved to pbsjatos; local meta alone cannot fill missing V1 sessions until pulls succeed.

Secrets / vars (Michelle)

Before re-running Boost CA workflow, add on HBClab/boost-beh:

  • Secret: JATOS_TOKEN (Michelle USER token for pbsjatos)
  • Optional variable: JATOS_BASE_URL = https://pbsjatos.psychology.uiowa.edu (workflow defaults to this if unset)

Test plan

  • Local metadata POST: old host ConnectTimeout; pbsjatos HTTP 200
  • gh workflow run "Boost CA workflow" after secrets set
  • Confirm meta updates include previously missing UI V1 subjects

Nightly Boost CA still timed out on the retired jatos.psychology host; read base URL and token from env (default pbsjatos) and pass them in the Actions workflow.

Co-authored-by: Cursor <cursoragent@cursor.com>
Copilot AI review requested due to automatic review settings August 2, 2026 03:01

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Note

Copilot was unable to run its full agentic suite in this review.

Updates JATOS connectivity for the nightly Boost CA pulls by removing hardcoded legacy host/token configuration and routing all JATOS calls through environment-provided settings (defaulting to pbsjatos).

Changes:

  • Read JATOS_TOKEN (and optional TEASE) from environment in main_handler.py instead of hardcoding secrets.
  • Replace hardcoded retired JATOS host URLs with JATOS_BASE_URL (defaulting to https://pbsjatos.psychology.uiowa.edu) in pull logic.
  • Wire JATOS_TOKEN / JATOS_BASE_URL into the GitHub Actions workflow and document the required env vars in the README.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 4 comments.

File Description
code/main_handler.py Removes inline token and requires JATOS_TOKEN via env; plumbs optional TEASE.
code/data_processing/pull_handler.py Builds API URLs from JATOS_BASE_URL (with pbsjatos default) instead of the retired host.
README.md Documents required/optional env vars and GH Actions secrets/vars.
.github/workflows/main.yml Passes JATOS_TOKEN, JATOS_BASE_URL, and TEASE into the nightly job environment.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread code/main_handler.py
Comment on lines +84 to +89
token = os.environ.get("JATOS_TOKEN", "").strip()
if not token:
raise RuntimeError(
"JATOS_TOKEN env var required (see HBC .env/.env). "
"Do not hardcode tokens in source."
)
Comment on lines +36 to +39
base = os.environ.get(
"JATOS_BASE_URL", "https://pbsjatos.psychology.uiowa.edu"
).rstrip("/")
url = f"{base}/jatos/api/v1/results/metadata"
Comment on lines +121 to +124
base = os.environ.get(
"JATOS_BASE_URL", "https://pbsjatos.psychology.uiowa.edu"
).rstrip("/")
url = f"{base}/jatos/api/v1/results/data"
Comment on lines +34 to +37
env:
JATOS_TOKEN: ${{ secrets.JATOS_TOKEN }}
JATOS_BASE_URL: ${{ vars.JATOS_BASE_URL || 'https://pbsjatos.psychology.uiowa.edu' }}
TEASE: ${{ secrets.TEASE }}
HBClab/boost-beh already has a TOKEN secret from the old setup; accept it until JATOS_TOKEN is added.

Co-authored-by: Cursor <cursoragent@cursor.com>
@bahaaaldin214

Copy link
Copy Markdown
Contributor Author

Smoke test (local)

  • Old host jatos.psychology.uiowa.edu: ConnectTimeout
  • New host pbsjatos.psychology.uiowa.edu: HTTP 200 with lab token

Follow-up needed after merge

Handler.IDs still lists old study IDs (~898–996). On pbsjatos those return 0 studies. Visible remapped IDs so far are mostly IA/IB/IC in the ~7–47 range (titles like IA_AF). Pull class still requires 6 IDs per task, so a full pbsjatos study-ID remap is required before V1 gaps fill.

Repo already has secret TOKEN; workflow accepts JATOS_TOKEN || TOKEN. Optional var JATOS_BASE_URL defaults to pbsjatos in the workflow expression.

Title-match IA/IB/IC (plus available OA/OB/OC) so pulls hit live studies; allow fewer than 6 IDs; LSS root via BOOST_LSS_ROOT.

Co-authored-by: Cursor <cursoragent@cursor.com>
@bahaaaldin214

Copy link
Copy Markdown
Contributor Author

Follow-up: study ID + path fix

Local smoke (Michelle token → pbsjatos):

  • Handler.IDs['AF'] = [11, 30, 42] metadata OK (IA/IB/IC_AF)
  • Pull.load(days_ago=400) returned 25 AF frames
  • Pull now accepts 1–6 studyIds (many OA/OB/OC not on pbsjatos yet)
  • PathLogic default /mnt/nfs/lss/vosslabhpc/Projects/BOOST; override with BOOST_LSS_ROOT

Still needed for Actions: set repo secret JATOS_TOKEN to working pbsjatos USER token (was 401).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants