modlee.client module

Modlee client for modlee server.

class modlee.client.ModleeClient(origin='http://127.0.0.1:7070', api_key=None, *args, **kwargs)[source]

Bases: object

A client for making requests to the server.

property available

Check if the server is available.

Returns:

Whether the server is available.

get(path='', *args, **kwargs)[source]

Get a request.

Parameters:

path – The URL path, defaults to “”.

Returns:

The response.

get_attr(path='')[source]

Get an attribute from the server.

Parameters:

path – The server-side path of the attribute to get, defaults to “”.

Returns:

The server attribute.

get_callable(path='')[source]

Get a callable function from the server.

Parameters:

path – The server-side path of the callable to get, defaults to “”.

Returns:

The callable, or None if not retrievable.

get_module(path='')[source]

Get a module from the server.

Parameters:

path – the server-side path of the module to get, defaults to “”.

Returns:

The module, or None if not retrievable.

get_script(path='')[source]

Get a script from the server.

Parameters:

path – The server-side path of the script to get, defaults to “”.

Returns:

The script as text, or None if not retrievable.

login(api_key='')[source]

Log the user in.

Parameters:

api_key – The user’s ID

post(path='', *args, **kwargs)[source]

Post a request.

Parameters:

path – The URL path, defaults to “”.

Returns:

The response.

post_file(file, filepath)[source]

Post a file (as text) to save on the server.

Parameters:
  • file – The local file to send.

  • filepath – The server-side relative path for the file.

Returns:

Response if successful, None if failed.

post_run(run_path)[source]

Post a local experiment run to save on the server.

Parameters:

run_path – The path of the run to save.

Returns:

Whether saving all files was successful. Partial failures still return False.

post_run_as_json(run_path)[source]

Convert the specified mlruns’ directory structure and files to JSON format, excluding files that match patterns in ignore_files. Tracks files that could not be processed.

Parameters:

run_path – The path of the run to convert to JSON.

Returns:

A dictionary representing the directory structure and files in JSON format, or None if the directory is empty or doesn’t exist.