Skip to content

Commit

Permalink
fix escaping for deleting jobs. hullplot bug. scope joining with inpu…
Browse files Browse the repository at this point in the history
…t. version 0.2.1
  • Loading branch information
enjalot committed May 2, 2024
1 parent 34c10c9 commit 2ddf68d
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 10 deletions.
2 changes: 1 addition & 1 deletion latentscope/__version__.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = '0.2.0'
__version__ = '0.2.1'
4 changes: 3 additions & 1 deletion latentscope/scripts/scope.py
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,9 @@ def get_next_scopes_number(dataset):
json.dump([], f)

input_df = pd.read_parquet(os.path.join(DATA_DIR, dataset_id, "input.parquet"))
combined_df = input_df[input_df.index.isin(scope_parquet['ls_index'])]
input_df.reset_index(inplace=True)
input_df = input_df[input_df['index'].isin(scope_parquet['ls_index'])]
combined_df = input_df.join(scope_parquet.set_index('ls_index'), on='index', rsuffix='_ls')
combined_df.to_parquet(os.path.join(directory, id + "-input.parquet"))

print("wrote scope", id)
Expand Down
5 changes: 3 additions & 2 deletions latentscope/server/bulk.py
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,7 @@ def delete_rows():

def update_combined(df, dataset_id, scope_id):
input_df = pd.read_parquet(os.path.join(DATA_DIR, dataset_id, "input.parquet"))
combined_df = input_df[input_df.index.isin(df['ls_index'])]
input_df.reset_index(inplace=True)
input_df = input_df[input_df['index'].isin(df['ls_index'])]
combined_df = input_df.join(df.set_index('ls_index'), on='index', rsuffix='_ls')
combined_df.to_parquet(os.path.join(DATA_DIR, dataset_id, "scopes", scope_id + "-input.parquet"))

15 changes: 10 additions & 5 deletions latentscope/server/jobs.py
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,8 @@ def delete_embedding():


job_id = str(uuid.uuid4())
command = f'rm -rf "{os.path.join(DATA_DIR, dataset, "embeddings", f"{embedding_id}*")}"'
path = os.path.join(DATA_DIR, dataset, "embeddings", f"{embedding_id}*").replace(" ", "\\ ")
command = f'rm -rf {path}'
for umap in umaps_to_delete:
delete_umap(dataset, umap)
threading.Thread(target=run_job, args=(dataset, job_id, command)).start()
Expand Down Expand Up @@ -284,10 +285,12 @@ def delete_umap(dataset, umap_id):


job_id = str(uuid.uuid4())
command = f'rm -rf "{os.path.join(DATA_DIR, dataset, "umaps", f"{umap_id}*")}"'
path = os.path.join(DATA_DIR, dataset, "umaps", f"{umap_id}*").replace(" ", "\\ ")
command = f'rm -rf {path}'
# Create the rm -rf commands from the clusters_to_delete list
for cluster in clusters_to_delete:
command += f'; rm "{os.path.join(DATA_DIR, dataset, "clusters", f"{cluster}*")}"'
cpath = os.path.join(DATA_DIR, dataset, "clusters", f"{cluster}*").replace(" ", "\\ ")
command += f'; rm -rf {cpath}'
threading.Thread(target=run_job, args=(dataset, job_id, command)).start()
return jsonify({"job_id": job_id})

Expand All @@ -310,7 +313,8 @@ def delete_cluster():
dataset = request.args.get('dataset')
cluster_id = request.args.get('cluster_id')
job_id = str(uuid.uuid4())
command = f'rm -rf "{os.path.join(DATA_DIR, dataset, "clusters", f"{cluster_id}*")}"'
path = os.path.join(DATA_DIR, dataset, "clusters", f"{cluster_id}*").replace(" ", "\\ ")
command = f'rm -rf {path}'
threading.Thread(target=run_job, args=(dataset, job_id, command)).start()
return jsonify({"job_id": job_id})

Expand Down Expand Up @@ -354,7 +358,8 @@ def delete_scope():
scope_id = request.args.get('scope_id')

job_id = str(uuid.uuid4())
command = f'rm -rf "{os.path.join(DATA_DIR, dataset, "scopes", f"{scope_id}*")}"'
path = os.path.join(DATA_DIR, dataset, "scopes", f"{scope_id}*").replace(" ", "\\ ")
command = f'rm -rf {path}'
threading.Thread(target=run_job, args=(dataset, job_id, command)).start()
return jsonify({"job_id": job_id})

2 changes: 1 addition & 1 deletion web/src/components/HullPlot.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { useEffect, useRef } from 'react';
// import { scaleLinear } from 'd3-scale';
import { line, curveLinearClosed, curveCatmullRomClosed } from 'd3-shape';
import { select } from 'd3-selection';
// import { transition } from 'd3-transition';
import { transition } from 'd3-transition';
import { easeExpOut, easeExpIn, easeCubicInOut} from 'd3-ease';
// import { interpolate } from 'flubber';

Expand Down

0 comments on commit 2ddf68d

Please sign in to comment.