fluxcloud.main.solve package

Submodules

fluxcloud.main.solve.database module

class fluxcloud.main.solve.database.Database(filename=':memory:')[source]

Bases: object

In-memory database to query instances.

add_instance(cloud_name, instance)[source]

Generic ability to add instance to flat database

execute(**kwargs)
execute_many(**kwargs)
filter_instances(props)[source]

Use properties to filter instances down to a desired set based.

fluxcloud.main.solve.database.parse_range(key, value)[source]

Given a stated range, e.g.,:

range_gpus: {‘min’: 2, ‘max’: None}

Return either a min/max rule, or just a min,or just a max.

fluxcloud.main.solve.database.parse_value(key, value)[source]

Parse a provided attribute value into an query. If we get here, it’s not a range.

True/False -> 1, 0 string -> “string”

class fluxcloud.main.solve.database.with_connection(func)[source]

Bases: object

Provide the function with a connection with open and close.

This is used as a decorator. When added, self.conn of the class is instantiated for interacting with, and cleaned up at the end.

fluxcloud.main.solve.properties module

class fluxcloud.main.solve.properties.Properties(properties, **kwargs)[source]

Bases: object

Properties from a schema to go into a solve.

not_solver_properties = ['include_list', 'exclude_list']
range_properties = ['cpus', 'instance_storage', 'memory', 'gpu_memory']
set_gpu_properties()[source]

Parse desired properties into single GPU request. There is both a min/max/number specification and a general flag.

set_not_solver_properties(properties)[source]

These properties are used later (e.g., to filter a final set based on name).

set_properties(**kwargs)[source]

Given an unknown set of command line arguments, parse into known instance properties. This resets properties / defined on the instance.

We assume that properties coming from argumnts might have a “-” instead of _.

set_range_properties()[source]

Consolidate range into either min/max or one value.

skip_patterns = ['price-per-hour']

fluxcloud.main.solve.solver module

class fluxcloud.main.solve.solver.Solver[source]

Bases: object

Class to orchestrate a selection Solver.

This originally used clingo, but since clingo doesn’t support floats (yikes) I refactored to create an in memory database to query.

add_instances(cloud_name, instance_group)[source]

Add cloud instances to the database

add_properties(props)[source]

Add properties to the setup

solve()[source]

A manual solve just uses python filtering!

Module contents