Skip to content

Commit

Permalink
Revert "Midterm milestone from CMU team on Develop dask"
Browse files Browse the repository at this point in the history
  • Loading branch information
pluflou authored Apr 25, 2024
1 parent 03ce74d commit d16bc28
Show file tree
Hide file tree
Showing 30 changed files with 1,168,519 additions and 4,644 deletions.
13 changes: 0 additions & 13 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -323,16 +323,3 @@ tags
[._]*.un~

# End of https://www.toptal.com/developers/gitignore/api/vim
/sdt_dask/dataplugs/example_data
sdt_dask/examples/summary_report_fargate.csv
sdt_dask/results/dask-report-fargate-or.html
sdt_dask/results/summary_report.csv
sdt_dask/results/dask-report.html
sdt_dask/examples/summary_report.csv
/sdt_dask/dataplugs/spwr_sensor_0
/sdt_dask/dataplugs/example_data
/sdt_dask/results
/sdt_dask/dataplugs/example_data
/sdt_dask/results
/sdt_dask/results

8 changes: 0 additions & 8 deletions .idea/.gitignore

This file was deleted.

12 changes: 0 additions & 12 deletions .idea/solar-data-tools.iml

This file was deleted.

114 changes: 45 additions & 69 deletions sdt_dask/clients/aws/fargate.py
Original file line number Diff line number Diff line change
@@ -1,69 +1,45 @@
# TODO: Change all documentation to sphinx
try:
# Import checks
import os
from sdt_dask.clients.clients import Clients
from dask_cloudprovider.aws import FargateCluster
from dask.distributed import Client

# Raises exception if modules aren't installed in the environment
except ModuleNotFoundError as error:
packages = "\tos\n\tdask.distributed\n\tdask_cloudprovider"
msg = f"{error}\n[!] Check or reinstall the following packages\n{packages}"
raise ModuleNotFoundError(msg)

finally:
class Fargate(Clients):

def __init__(self,
image: str = "",
tags: dict = {}, # optional
vpc: str = "",
region_name: str = "",
environment: dict = {},
n_workers: int = 10,
threads_per_worker: int = 2
):
self.image = image
self.tags = tags
self.vpc = vpc
self.region_name = region_name
self.environment = environment
self.n_workers = n_workers
self.threads_per_worker = threads_per_worker
def _check_versions(self):
data = self.client.get_versions(check=True)
scheduler_pkgs = data['scheduler']['packages']
client_pkgs = data['client']['packages']

for (c_pkg, c_ver), (s_pkg, s_ver) in zip(scheduler_pkgs.items(), client_pkgs.items()):
if c_ver != s_ver:
msg = 'Please Update the client version to match the Scheduler version'
raise EnvironmentError(f"{c_pkg} version Mismatch:\n\tScheduler: {s_ver} vs Client: {c_ver}\n{msg}")

def init_client(self) -> tuple:
try:
print("[i] Initilializing Fargate Cluster ...")

cluster = FargateCluster(
tags = self.tags,
image = self.image,
vpc = self.vpc,
region_name = self.region_name,
environment = self.environment,
n_workers = self.n_workers,
worker_nthreads = self.threads_per_worker
)

print("[i] Initialized Fargate Cluster")
print("[i] Initilializing Dask Client ...")

self.client = Client(cluster)

self._check_versions()

print(f"[>] Dask Dashboard: {self.client.dashboard_link}")

return self.client, cluster
except Exception as e:
raise Exception(e)
"""Note: this module is not yet implemented.
This can be written as an example of how to create a Dask client (given some resources)
that will integrate seamlessly with our SDT Dask tool.
We should determine if this module/class would be helpful/is needed.
"""

from dask.distributed import Client
from dask_cloudprovider.aws import FargateCluster
"""
Optional:
tags: only use this if your organization enforces tag policies
Required:
image: should be a dockerhub public image. Please customize your image if needed
"""


def _init_fargate_cluster(**kwargs) -> FargateCluster:
cluster = FargateCluster(kwargs)
return cluster


def _init_dask_client(cluster: FargateCluster) -> Client:
client = Client(cluster)
return client


def get_fargate_cluster(
tags={},
image="",
vpc="",
region_name="",
environment={},
n_workers=10
) -> Client:

cluster = _init_fargate_cluster(
tags={},
image="",
vpc="",
region_name="",
environment={},
n_workers=10
)

return _init_dask_client(cluster)
2 changes: 1 addition & 1 deletion sdt_dask/clients/aws/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
solar-data-tools @ git+https://github.com/zhanghaoc/solar-data-tools@develop-dask
solar-data-tools @ git+https://github.com/slacgismo/solar-data-tools@develop-dask
accessible-pygments==0.0.4
aiobotocore==2.4.2
aiohttp==3.8.3
Expand Down
29 changes: 0 additions & 29 deletions sdt_dask/clients/clients.py

This file was deleted.

80 changes: 0 additions & 80 deletions sdt_dask/clients/local.py

This file was deleted.

Empty file removed sdt_dask/dask_tool/__init__.py
Empty file.
Loading

0 comments on commit d16bc28

Please sign in to comment.