forked from project-codeflare/codeflare-sdk
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Refactor unit tests to eliminate pytest warnings:
- Refactored to remove return statements from the tests that are ran. - Created the respective support functions. - Silenced warnings that originate from pkg_resources.
- Loading branch information
1 parent
d158348
commit 61d7f3b
Showing
3 changed files
with
108 additions
and
57 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
from codeflare_sdk.job.jobs import ( | ||
DDPJobDefinition, | ||
DDPJob, | ||
) | ||
|
||
from codeflare_sdk.cluster.cluster import ( | ||
Cluster, | ||
ClusterConfiguration, | ||
) | ||
|
||
|
||
def createTestDDP(): | ||
ddp = DDPJobDefinition( | ||
script="test.py", | ||
m=None, | ||
script_args=["test"], | ||
name="test", | ||
cpu=1, | ||
gpu=0, | ||
memMB=1024, | ||
h=None, | ||
j="2x1", | ||
env={"test": "test"}, | ||
max_retries=0, | ||
mounts=[], | ||
rdzv_port=29500, | ||
scheduler_args={"requirements": "test"}, | ||
) | ||
return ddp | ||
|
||
|
||
def createDDPJob_no_cluster(ddp_def, cluster): | ||
return DDPJob(ddp_def, cluster) | ||
|
||
|
||
def createClusterConfig(): | ||
config = ClusterConfiguration( | ||
name="unit-test-cluster", | ||
namespace="ns", | ||
num_workers=2, | ||
min_cpus=3, | ||
max_cpus=4, | ||
min_memory=5, | ||
max_memory=6, | ||
num_gpus=7, | ||
instascale=True, | ||
machine_types=["cpu.small", "gpu.large"], | ||
image_pull_secrets=["unit-test-pull-secret"], | ||
dispatch_priority="default", | ||
) | ||
return config | ||
|
||
|
||
def createClusterWithConfig(): | ||
cluster = Cluster(createClusterConfig()) | ||
return cluster | ||
|
||
|
||
def createDDPJob_with_cluster(ddp_def, cluster=createClusterWithConfig()): | ||
return DDPJob(ddp_def, cluster) |