Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 2 additions & 4 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
# FROM gcr.io/neuromancer-seung-import/pychunkedgraph:graph-tool_dracopy
FROM seunglab/pychunkedgraph:graph-tool_dracopy
FROM caveconnectome/pychunkedgraph:base_042124
COPY override/timeout.conf /etc/nginx/conf.d/timeout.conf
COPY override/supervisord.conf /etc/supervisor/conf.d/supervisord.conf
COPY requirements.txt /app
RUN pip install --upgrade pip \
&& pip install --no-cache-dir --upgrade -r requirements.txt
RUN pip install --no-cache-dir -r requirements.txt
COPY . /app
18 changes: 6 additions & 12 deletions cloudbuild.yaml
Original file line number Diff line number Diff line change
@@ -1,31 +1,25 @@
steps:
# Login to Docker Hub
- name: "gcr.io/cloud-builders/docker"
entrypoint: "bash"
args: ["-c", "docker login --username=$$USERNAME --password=$$PASSWORD"]
secretEnv: ["USERNAME", "PASSWORD"]
# - name: 'gcr.io/cloud-builders/docker'
# args: [ 'build', '-t', 'gcr.io/$PROJECT_ID/pychunkedgraph', '.' ]

- name: "gcr.io/cloud-builders/docker"
entrypoint: "bash"
args:
- "-c"
- |
docker build -t gcr.io/$PROJECT_ID/pychunkedgraph:$TAG_NAME .
docker build -t $$USERNAME/pychunkedgraph:$TAG_NAME .
timeout: 600s
- name: "gcr.io/cloud-builders/docker"
entrypoint: "bash"
args:
[
"-c",
"docker tag gcr.io/$PROJECT_ID/pychunkedgraph:$TAG_NAME $$USERNAME/pychunkedgraph:$TAG_NAME",
]
secretEnv: ["USERNAME"]

# Push the final image to Dockerhub
- name: "gcr.io/cloud-builders/docker"
entrypoint: "bash"
args: ["-c", "docker push $$USERNAME/pychunkedgraph:$TAG_NAME"]
secretEnv: ["USERNAME"]
images:
- "gcr.io/$PROJECT_ID/pychunkedgraph:$TAG_NAME"

availableSecrets:
secretManager:
- versionName: projects/$PROJECT_ID/secrets/docker-password/versions/1
Expand Down
2 changes: 1 addition & 1 deletion pychunkedgraph/app/app_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -250,7 +250,7 @@ def ccs(coordinates_nm_):
ccs = [np.array(list(cc)) for cc in nx.connected_components(graph)]
return ccs

coordinates = np.array(coordinates, dtype=np.int)
coordinates = np.array(coordinates, dtype=int)
coordinates_nm = coordinates * cg.cv.resolution

node_ids = np.array(node_ids, dtype=np.uint64)
Expand Down
2 changes: 1 addition & 1 deletion pychunkedgraph/app/meshing/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ def handle_get_manifest(table_id, node_id):
if "bounds" in request.args:
bounds = request.args["bounds"]
bounding_box = np.array(
[b.split("-") for b in bounds.split("_")], dtype=np.int
[b.split("-") for b in bounds.split("_")], dtype=int
).T
else:
bounding_box = None
Expand Down
70 changes: 5 additions & 65 deletions pychunkedgraph/app/segmentation/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
from pychunkedgraph.backend import history as cg_history
from pychunkedgraph.backend import lineage
from pychunkedgraph.backend.utils import column_keys, basetypes
from pychunkedgraph.graph_analysis import analysis, contact_sites
from pychunkedgraph.graph_analysis import analysis
from pychunkedgraph.backend.graphoperation import GraphEditOperation

__api_versions__ = [0, 1]
Expand Down Expand Up @@ -516,7 +516,7 @@ def handle_leaves(table_id, root_id):
if "bounds" in request.args:
bounds = request.args["bounds"]
bounding_box = np.array(
[b.split("-") for b in bounds.split("_")], dtype=np.int
[b.split("-") for b in bounds.split("_")], dtype=int
).T
else:
bounding_box = None
Expand Down Expand Up @@ -559,7 +559,7 @@ def handle_leaves_many(table_id):
if "bounds" in request.args:
bounds = request.args["bounds"]
bounding_box = np.array(
[b.split("-") for b in bounds.split("_")], dtype=np.int
[b.split("-") for b in bounds.split("_")], dtype=int
).T
else:
bounding_box = None
Expand Down Expand Up @@ -591,7 +591,7 @@ def handle_leaves_from_leave(table_id, atomic_id):
if "bounds" in request.args:
bounds = request.args["bounds"]
bounding_box = np.array(
[b.split("-") for b in bounds.split("_")], dtype=np.int
[b.split("-") for b in bounds.split("_")], dtype=int
).T
else:
bounding_box = None
Expand All @@ -618,7 +618,7 @@ def handle_subgraph(table_id, root_id):
if "bounds" in request.args:
bounds = request.args["bounds"]
bounding_box = np.array(
[b.split("-") for b in bounds.split("_")], dtype=np.int
[b.split("-") for b in bounds.split("_")], dtype=int
).T
else:
bounding_box = None
Expand Down Expand Up @@ -847,66 +847,6 @@ def oldest_timestamp(table_id):
return earliest_timestamp


### CONTACT SITES --------------------------------------------------------------


def handle_contact_sites(table_id, root_id):
partners = request.args.get("partners", True, type=app_utils.toboolean)
as_list = request.args.get("as_list", True, type=app_utils.toboolean)
areas_only = request.args.get("areas_only", True, type=app_utils.toboolean)

current_app.table_id = table_id
user_id = str(g.auth_user["id"])
current_app.user_id = user_id

timestamp = _parse_timestamp(
"timestamp", default_timestamp=time.time(), return_datetime=True
)

if "bounds" in request.args:
bounds = request.args["bounds"]
bounding_box = np.array(
[b.split("-") for b in bounds.split("_")], dtype=np.int
).T
else:
bounding_box = None

# Call ChunkedGraph
cg = app_utils.get_cg(table_id)

cs_list, cs_metadata = contact_sites.get_contact_sites(
cg,
np.uint64(root_id),
bounding_box=bounding_box,
compute_partner=partners,
end_time=timestamp,
as_list=as_list,
areas_only=areas_only,
)

return cs_list, cs_metadata


def handle_pairwise_contact_sites(table_id, first_node_id, second_node_id):
current_app.request_type = "pairwise_contact_sites"
current_app.table_id = table_id
user_id = str(g.auth_user["id"])
current_app.user_id = user_id

timestamp = _parse_timestamp("timestamp", time.time(), return_datetime=True)

exact_location = request.args.get("exact_location", True, type=app_utils.toboolean)
cg = app_utils.get_cg(table_id)
contact_sites_list, cs_metadata = contact_sites.get_contact_sites_pairwise(
cg,
np.uint64(first_node_id),
np.uint64(second_node_id),
end_time=timestamp,
exact_location=exact_location,
)
return contact_sites_list, cs_metadata


### SPLIT PREVIEW --------------------------------------------------------------


Expand Down
10 changes: 0 additions & 10 deletions pychunkedgraph/app/segmentation/legacy/routes.py
Original file line number Diff line number Diff line change
Expand Up @@ -164,16 +164,6 @@ def handle_subgraph(table_id, root_id):
return app_utils.tobinary(subgraph_result)


### CONTACT SITES --------------------------------------------------------------


@bp.route("/<table_id>/segment/<root_id>/contact_sites", methods=["POST", "GET"])
@auth_requires_permission("view")
def handle_contact_sites(table_id, root_id):
contact_sites = common.handle_contact_sites(table_id, root_id)
return jsonify(contact_sites)


### CHANGE LOG -----------------------------------------------------------------


Expand Down
35 changes: 0 additions & 35 deletions pychunkedgraph/app/segmentation/v1/routes.py
Original file line number Diff line number Diff line change
Expand Up @@ -316,41 +316,6 @@ def handle_subgraph(table_id, node_id):
return jsonify_with_kwargs(resp, int64_as_str=int64_as_str)


### CONTACT SITES --------------------------------------------------------------


@bp.route("/table/<table_id>/node/<node_id>/contact_sites", methods=["GET"])
@auth_requires_permission("view")
@remap_public(edit=False)
def handle_contact_sites(table_id, node_id):
int64_as_str = request.args.get("int64_as_str", default=False, type=toboolean)
contact_sites, contact_site_metadata = common.handle_contact_sites(
table_id, node_id
)
resp = {
"contact_sites": contact_sites,
"contact_site_metadata": contact_site_metadata,
}
return jsonify_with_kwargs(resp, int64_as_str=int64_as_str)


@bp.route(
"/table/<table_id>/node/contact_sites_pair/<first_node_id>/<second_node_id>",
methods=["GET"],
)
@auth_requires_permission("view")
@remap_public(edit=False)
def handle_pairwise_contact_sites(table_id, first_node_id, second_node_id):
int64_as_str = request.args.get("int64_as_str", default=False, type=toboolean)
contact_sites, contact_site_metadata = common.handle_pairwise_contact_sites(
table_id, first_node_id, second_node_id
)
resp = {
"contact_sites": contact_sites,
"contact_site_metadata": contact_site_metadata,
}
return jsonify_with_kwargs(resp, int64_as_str=int64_as_str)


### CHANGE LOG -----------------------------------------------------------------

Expand Down
6 changes: 3 additions & 3 deletions pychunkedgraph/backend/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,14 +75,14 @@ def bigtable_config(self):

@property
def resolution(self) -> np.ndarray:
return np.array(self._ws_cv.resolution)
return np.array(self._ws_cv.resolution)

@property
def layer_count(self) -> int:
if self._layer_count:
return self._layer_count
bbox = np.array(self._ws_cv.bounds.to_list()).reshape(2, 3)
n_chunks = ((bbox[1] - bbox[0]) / self._graph_config.chunk_size).astype(np.int)
n_chunks = ((bbox[1] - bbox[0]) / self._graph_config.chunk_size).astype(int)
self._layer_count = (
int(np.ceil(log_n(np.max(n_chunks), self._graph_config.fanout))) + 2
)
Expand All @@ -102,7 +102,7 @@ def layer_chunk_bounds(self) -> Dict:
layer_bounds_d = {}
for layer in range(2, self.layer_count):
layer_bounds = chunks_boundary / (2 ** (layer - 2))
layer_bounds_d[layer] = np.ceil(layer_bounds).astype(np.int)
layer_bounds_d[layer] = np.ceil(layer_bounds).astype(int)
self._layer_bounds_d = layer_bounds_d
return self._layer_bounds_d

Expand Down
Loading