Skip to content

Commit a0d7250

Browse files
authored
Merge pull request #225 from fabric-testbed/fim_importer
singleton importer
2 parents dc7214d + a897a99 commit a0d7250

File tree

6 files changed

+16
-14
lines changed

6 files changed

+16
-14
lines changed

Dockerfile-auth

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
FROM python:3.9.0
22
MAINTAINER Komal Thareja<[email protected]>
33

4-
ARG HANDLERS_VER=1.3.2
4+
ARG HANDLERS_VER=1.3.3
55

66
RUN mkdir -p /usr/src/app
77
WORKDIR /usr/src/app

fabric_cf/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
__VERSION__ = "1.3.1"
1+
__VERSION__ = "1.3.2"

fabric_cf/actor/core/kernel/slice_state_machine.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -202,7 +202,6 @@ def all_failed(*, reservations: ReservationSet) -> bool:
202202
"""
203203
We don't introduce a special state to flag when a slice is ALL FAILED, however this helper function helps decide
204204
when to GC a slice
205-
206205
@return true or false
207206
"""
208207
bins = StateBins()
@@ -252,7 +251,7 @@ def transition_slice(self, *, operation: SliceOperation, reservations: Reservati
252251
bins.add(s=r.get_state())
253252

254253
if self.state == SliceState.Nascent or self.state == SliceState.Configuring:
255-
if not bins.has_state_other_than(ReservationStates.Active):
254+
if not bins.has_state_other_than(ReservationStates.Active, ReservationStates.Closed):
256255
self.state = SliceState.StableOK
257256

258257
if (not bins.has_state_other_than(ReservationStates.Active, ReservationStates.Failed,
@@ -265,7 +264,7 @@ def transition_slice(self, *, operation: SliceOperation, reservations: Reservati
265264
self.state = SliceState.Closing
266265

267266
elif self.state == SliceState.Modifying:
268-
if not bins.has_state_other_than(ReservationStates.Active):
267+
if not bins.has_state_other_than(ReservationStates.Active, ReservationStates.Closed):
269268
self.state = SliceState.ModifyOK
270269

271270
if (not bins.has_state_other_than(ReservationStates.Active, ReservationStates.Failed,
@@ -300,4 +299,4 @@ def get_state(self) -> SliceState:
300299
return self.state
301300

302301
def clear(self):
303-
self.state = SliceState.Nascent
302+
self.state = SliceState.Nascent

fabric_cf/actor/fim/fim_helper.py

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,8 @@ class FimHelper:
111111
"""
112112
Provides methods to load Graph Models and perform various operations on them
113113
"""
114+
__neo4j_graph_importer = None
115+
114116
@staticmethod
115117
def get_neo4j_importer(neo4j_config: dict = None) -> ABCGraphImporter:
116118
"""
@@ -123,11 +125,12 @@ def get_neo4j_importer(neo4j_config: dict = None) -> ABCGraphImporter:
123125
neo4j_config = GlobalsSingleton.get().get_config().get_global_config().get_neo4j_config()
124126
logger = GlobalsSingleton.get().get_logger()
125127

126-
neo4j_graph_importer = Neo4jGraphImporter(url=neo4j_config["url"], user=neo4j_config["user"],
127-
pswd=neo4j_config["pass"],
128-
import_host_dir=neo4j_config["import_host_dir"],
129-
import_dir=neo4j_config["import_dir"], logger=logger)
130-
return neo4j_graph_importer
128+
if FimHelper.__neo4j_graph_importer is None:
129+
FimHelper.__neo4j_graph_importer = Neo4jGraphImporter(url=neo4j_config["url"], user=neo4j_config["user"],
130+
pswd=neo4j_config["pass"],
131+
import_host_dir=neo4j_config["import_host_dir"],
132+
import_dir=neo4j_config["import_dir"], logger=logger)
133+
return FimHelper.__neo4j_graph_importer
131134

132135
@staticmethod
133136
def get_networkx_importer(logger: logging.Logger = None) -> ABCGraphImporter:

fabric_cf/orchestrator/core/response_builder.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
from fabric_mb.message_bus.messages.lease_reservation_avro import LeaseReservationAvro
2929
from fabric_mb.message_bus.messages.reservation_mng import ReservationMng
3030
from fabric_mb.message_bus.messages.slice_avro import SliceAvro
31-
from fim.graph.abc_property_graph import ABCPropertyGraph
31+
from fim.slivers.json import JSONSliver
3232

3333
from fabric_cf.actor.core.common.constants import Constants
3434
from fabric_cf.actor.core.kernel.reservation_states import ReservationStates, ReservationPendingStates, JoinState
@@ -80,7 +80,7 @@ def get_reservation_summary(*, res_list: List[ReservationMng]) -> List[dict]:
8080
if sliver is not None:
8181
res_dict[ResponseBuilder.PROP_GRAPH_NODE_ID] = sliver.node_id
8282
res_dict[ResponseBuilder.PROP_SLIVER_TYPE] = type(sliver).__name__
83-
res_dict[ResponseBuilder.PROP_SLIVER] = ABCPropertyGraph.sliver_to_dict(sliver)
83+
res_dict[ResponseBuilder.PROP_SLIVER] = JSONSliver.sliver_to_json(sliver)
8484

8585
if reservation.get_start() is not None:
8686
start_time = ActorClock.from_milliseconds(milli_seconds=reservation.get_start())

requirements.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,4 +13,4 @@ typing-extensions==3.7.4.3
1313
six==1.15.0
1414
wrapt==1.12.1
1515
fabric-message-bus==1.3.0
16-
fabric-fim==1.3.3
16+
fabric-fim==1.3.4

0 commit comments

Comments
 (0)