Skip to content

Commit

Permalink
Cleanup code
Browse files Browse the repository at this point in the history
  • Loading branch information
ChristianZaccaria committed Nov 24, 2023
1 parent 66fbcd6 commit a86c429
Show file tree
Hide file tree
Showing 6 changed files with 3 additions and 74 deletions.
21 changes: 1 addition & 20 deletions .github/workflows/e2e_tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -30,25 +30,6 @@ jobs:
runs-on: ubuntu-20.04

steps:
- name: Cleanup
run: |
ls -lart
echo "Initial status:"
df -h
echo "Cleaning up resources:"
sudo swapoff -a
sudo rm -f /swapfile
sudo apt clean
sudo rm -rf /usr/share/dotnet
sudo rm -rf /opt/ghc
sudo rm -rf "/usr/local/share/boost"
sudo rm -rf "$AGENT_TOOLSDIRECTORY"
docker rmi $(docker image ls -aq)
echo "Final status:"
df -h
- name: Checkout code
uses: actions/checkout@v2
with:
Expand Down Expand Up @@ -92,7 +73,7 @@ jobs:
run: |
export CODEFLARE_TEST_TIMEOUT_SHORT=1m
export CODEFLARE_TEST_TIMEOUT_MEDIUM=5m
export CODEFLARE_TEST_TIMEOUT_LONG=15m
export CODEFLARE_TEST_TIMEOUT_LONG=20m
export CODEFLARE_TEST_OUTPUT_DIR=${{ env.TEMP_DIR }}
echo "CODEFLARE_TEST_OUTPUT_DIR=${CODEFLARE_TEST_OUTPUT_DIR}" >> $GITHUB_ENV
Expand Down
22 changes: 0 additions & 22 deletions tests/e2e/install-codeflare-sdk.sh
Original file line number Diff line number Diff line change
@@ -1,27 +1,5 @@
#!/bin/bash

# Generate zip file beforehand
# tar -czvf root-dir.tar.gz --exclude='.git' --exclude='.github' --exclude='.pytest_cache' ./

# Create temp-pod to contain the zip file
# kubectl apply -f temp-pod.yaml

# Copy the zip file to the temp-pod:/mnt
# kubectl cp root-dir.tar.gz temp-pod:/mnt

# Run a shell in the temp-pod
# kubectl exec -it temp-pod -- /bin/sh

# Unzip the zip file
# tar -xzvf /mnt/root-dir.tar.gz -C /mnt

# Not necessary as the PVC is mounted to /codeflare-sdk
# mv /mnt/* /codeflare-sdk/

## Copy files from temp-pod /mnt into the codeflare-sdk volume mount in this other pod.
# kubectl cp default/temp-pod:/mnt codeflare-sdk


cd ..

# Install Poetry and configure virtualenvs
Expand Down
1 change: 0 additions & 1 deletion tests/e2e/mnist_raycluster_sdk.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,6 @@
script="mnist.py",
scheduler_args={"requirements": "requirements.txt"},
)
print("Submitting Job OSAOUBDAUDDAOUBDOUBUBAD")
job = jobdef.submit(cluster)

done = False
Expand Down
10 changes: 1 addition & 9 deletions tests/e2e/mnist_raycluster_sdk_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ limitations under the License.
package e2e

import (
"bytes"
"os/exec"
"testing"

Expand Down Expand Up @@ -208,17 +207,10 @@ func TestMNISTRayClusterSDK(t *testing.T) {
test.T().Logf("Created Job %s/%s successfully", job.Namespace, job.Name)

go func() {
scriptName := "../.././copyscript.sh"
scriptName := "./sdk-to-pod.sh"
cmd := exec.Command(scriptName, namespace.Name)

var stdoutBuf, stderrBuf bytes.Buffer
cmd.Stdout = &stdoutBuf
cmd.Stderr = &stderrBuf

// Run the script
if err := cmd.Run(); err != nil {
t.Logf("STDOUT: %s", stdoutBuf.String())
t.Logf("STDERR: %s", stderrBuf.String())
t.Logf("Failed to run the script: %v", err)
}
}()
Expand Down
14 changes: 1 addition & 13 deletions copyscript.sh → tests/e2e/sdk-to-pod.sh
Original file line number Diff line number Diff line change
@@ -1,25 +1,13 @@
#!/bin/bash

# command to be ran on local host and not in the pod
# kubectl apply -f temp-pod.yaml
# kubectl cp ./ default/temp-pod4:/mnt



echo "starting"
namespace=$1
# podname=$(kubectl get pods -n "${namespace}" -o custom-columns=:metadata.name | grep "^sdk")
# kubectl cp ./ ${namespace}/${podname}:/codeflare-sdk

# kubectl cp ./ ${namespace}/temp-pod:/mnt

# TODO: find better way to wait for the pod to be running. We want to wait for the pod to be running before copying files.
sleep 60

# Get the name of the pod starting with 'sdk' and its status
read podname podstatus <<< $(kubectl get pods -n "${namespace}" -o custom-columns=:metadata.name,:status.phase | grep "^sdk" | awk '{print $1, $2}')

echo "$podname, $podstatus, $namespace"

# Check if the pod is found and is in 'Running' status
if [[ -n "$podname" && "$podstatus" == "Running" ]]; then
echo "Pod ${podname} is running. Proceeding to copy files."
Expand Down
9 changes: 0 additions & 9 deletions tests/e2e/support.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,6 @@ package e2e
import (
"embed"

"io/ioutil"

"github.com/onsi/gomega"

"github.com/project-codeflare/codeflare-common/support"
Expand All @@ -35,10 +33,3 @@ func ReadFile(t support.Test, fileName string) []byte {
t.Expect(err).NotTo(gomega.HaveOccurred())
return file
}

func ReadWhlFile(t support.Test, fileName string) []byte {
t.T().Helper()
file, err := ioutil.ReadFile(fileName)
t.Expect(err).NotTo(gomega.HaveOccurred())
return file
}

0 comments on commit a86c429

Please sign in to comment.