Skip to content

Commit

Permalink
fix: Use only local unitxt catalogs when in offline mode (#386)
Browse files Browse the repository at this point in the history
  • Loading branch information
ruivieira authored Jan 8, 2025
1 parent 101d4f9 commit 8a5a958
Show file tree
Hide file tree
Showing 2 changed files with 52 additions and 0 deletions.
4 changes: 4 additions & 0 deletions controllers/lmes/lmevaljob_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -787,6 +787,10 @@ func CreatePod(svcOpts *serviceOptions, job *lmesv1alpha1.LMEvalJob, log logr.Lo
Name: "HF_EVALUATE_OFFLINE",
Value: "1",
},
{
Name: "UNITXT_USE_ONLY_LOCAL_CATALOGS",
Value: "True",
},
}

// Enforce offline mode by default
Expand Down
48 changes: 48 additions & 0 deletions controllers/lmes/lmevaljob_controller_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,10 @@ func Test_SimplePod(t *testing.T) {
Name: "HF_EVALUATE_OFFLINE",
Value: "1",
},
{
Name: "UNITXT_USE_ONLY_LOCAL_CATALOGS",
Value: "True",
},
},
},
},
Expand Down Expand Up @@ -373,6 +377,10 @@ func Test_WithCustomPod(t *testing.T) {
Name: "HF_EVALUATE_OFFLINE",
Value: "1",
},
{
Name: "UNITXT_USE_ONLY_LOCAL_CATALOGS",
Value: "True",
},
},
},
{
Expand Down Expand Up @@ -575,6 +583,10 @@ func Test_EnvSecretsPod(t *testing.T) {
Name: "HF_EVALUATE_OFFLINE",
Value: "1",
},
{
Name: "UNITXT_USE_ONLY_LOCAL_CATALOGS",
Value: "True",
},
},
Command: generateCmd(svcOpts, job),
Args: generateArgs(svcOpts, job, log),
Expand Down Expand Up @@ -741,6 +753,10 @@ func Test_FileSecretsPod(t *testing.T) {
Name: "HF_EVALUATE_OFFLINE",
Value: "1",
},
{
Name: "UNITXT_USE_ONLY_LOCAL_CATALOGS",
Value: "True",
},
},
VolumeMounts: []corev1.VolumeMount{
{
Expand Down Expand Up @@ -1206,6 +1222,10 @@ func Test_ManagedPVC(t *testing.T) {
Name: "HF_EVALUATE_OFFLINE",
Value: "1",
},
{
Name: "UNITXT_USE_ONLY_LOCAL_CATALOGS",
Value: "True",
},
},

VolumeMounts: []corev1.VolumeMount{
Expand Down Expand Up @@ -1361,6 +1381,10 @@ func Test_ExistingPVC(t *testing.T) {
Name: "HF_EVALUATE_OFFLINE",
Value: "1",
},
{
Name: "UNITXT_USE_ONLY_LOCAL_CATALOGS",
Value: "True",
},
},
VolumeMounts: []corev1.VolumeMount{
{
Expand Down Expand Up @@ -1533,6 +1557,10 @@ func Test_PVCPreference(t *testing.T) {
Name: "HF_EVALUATE_OFFLINE",
Value: "1",
},
{
Name: "UNITXT_USE_ONLY_LOCAL_CATALOGS",
Value: "True",
},
},
VolumeMounts: []corev1.VolumeMount{
{
Expand Down Expand Up @@ -1736,6 +1764,10 @@ func Test_OfflineMode(t *testing.T) {
Name: "HF_EVALUATE_OFFLINE",
Value: "1",
},
{
Name: "UNITXT_USE_ONLY_LOCAL_CATALOGS",
Value: "True",
},
},
VolumeMounts: []corev1.VolumeMount{
{
Expand Down Expand Up @@ -1940,6 +1972,10 @@ func Test_ProtectedVars(t *testing.T) {
Name: "HF_EVALUATE_OFFLINE",
Value: "1",
},
{
Name: "UNITXT_USE_ONLY_LOCAL_CATALOGS",
Value: "True",
},
},
VolumeMounts: []corev1.VolumeMount{
{
Expand Down Expand Up @@ -2123,6 +2159,10 @@ func Test_OnlineModeDisabled(t *testing.T) {
Name: "HF_EVALUATE_OFFLINE",
Value: "1",
},
{
Name: "UNITXT_USE_ONLY_LOCAL_CATALOGS",
Value: "True",
},
},
VolumeMounts: []corev1.VolumeMount{
{
Expand Down Expand Up @@ -2632,6 +2672,10 @@ func Test_AllowCodeOfflineMode(t *testing.T) {
Name: "HF_EVALUATE_OFFLINE",
Value: "1",
},
{
Name: "UNITXT_USE_ONLY_LOCAL_CATALOGS",
Value: "True",
},
},
VolumeMounts: []corev1.VolumeMount{
{
Expand Down Expand Up @@ -2812,6 +2856,10 @@ func Test_OfflineModeWithOutput(t *testing.T) {
Name: "HF_EVALUATE_OFFLINE",
Value: "1",
},
{
Name: "UNITXT_USE_ONLY_LOCAL_CATALOGS",
Value: "True",
},
},
VolumeMounts: []corev1.VolumeMount{
{
Expand Down

0 comments on commit 8a5a958

Please sign in to comment.