Skip to content

Commit

Permalink
mf
Browse files Browse the repository at this point in the history
  • Loading branch information
mam10eks committed Nov 25, 2024
1 parent a4e28df commit 6edf44f
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 16 deletions.
19 changes: 11 additions & 8 deletions python-client/tira/pyterrier_integration.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import os
from pathlib import Path

from tira.tirex import IRDS_TO_TIREX_DATASET


Expand Down Expand Up @@ -311,10 +312,12 @@ def splade_index(self, dataset: str, approach: str = "workshop-on-open-web-searc

def pt_transformer(path):
import pyterrier as pt

if not pt.started():
pt.init()
# TODO hacked for the moment, in reality, we must delegate to the classes above.
return pt.transformer.get_transformer(pt.io.read_results(path + '/output/run.txt'))
return pt.transformer.get_transformer(pt.io.read_results(path + "/output/run.txt"))


def pt_artifact_entrypoint(url):
url = url.netloc + url.path
Expand All @@ -323,21 +326,21 @@ def pt_artifact_entrypoint(url):
for irds_id, tira_dataset_id in IRDS_TO_TIREX_DATASET.items():
if url.startswith(irds_id):
dataset_id = tira_dataset_id
url = url.replace(irds_id, 'ir-benchmarks')
url = url.replace(irds_id, "ir-benchmarks")
break
if not dataset_id:
raise ValueError('Very rough implementation...')
raise ValueError("Very rough implementation...")

from tira.rest_api_client import Client
from pathlib import Path
import json
from pathlib import Path

from tira.rest_api_client import Client

tira = Client()
ret = tira.get_run_output(url, dataset_id)

ret = Path(ret).parent
if not (ret / 'pt_meta.json').is_file():
with open(ret / 'pt_meta.json', 'w') as f:
if not (ret / "pt_meta.json").is_file():
with open(ret / "pt_meta.json", "w") as f:
f.write(json.dumps({"type": "tira", "format": "pt_transformer"}))
return str(ret.absolute())

11 changes: 3 additions & 8 deletions python-client/tira/rest_api_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,22 +13,19 @@

import pandas as pd
import requests
from tqdm import tqdm

from tira.local_execution_integration import LocalExecutionIntegration
from tira.pandas_integration import PandasIntegration
from tira.profiling_integration import ProfilingIntegration
from tira.pyterrier_integration import (
PyTerrierAnceIntegration,
PyTerrierIntegration,
PyTerrierSpladeIntegration,
)
from tira.pyterrier_integration import PyTerrierAnceIntegration, PyTerrierIntegration, PyTerrierSpladeIntegration
from tira.tira_redirects import (
RESOURCE_REDIRECTS,
TASKS_WITH_REDIRECT_MERGING,
dataset_ir_redirects,
mirror_url,
redirects,
)
from tqdm import tqdm

from .tira_client import TiraClient

Expand Down Expand Up @@ -841,11 +838,9 @@ def __listdir_failsave(self, path: str):
except Exception:
return []


def _well_known(self):
pass


def input_run_in_sandbox(self, approach: str):
"""
Returns the directory with the outputs of an approach in mounted into the sandbox. returns None if not in the
Expand Down

0 comments on commit 6edf44f

Please sign in to comment.