Skip to main content

Overview

The Project class provides access to project information and all associated resources including users, servers, floating IPs, and quotas.

Basic Project Lookup

Retrieve project information by name:
from myos.project import Project

project = Project(name='Condor')

print(project.id)
# Output: '2d8252b430c2405da24d74df2004c24b'

print(project.name)
# Output: 'Condor'
You can initialize a Project by either name or project_id.

Project Users

Retrieve all users with access to a project:
from myos.project import Project

project = Project(name='Condor')
users = project.users

for user in users:
    print(user.email)

Project Servers

Get all servers running in a project:
from myos.project import Project

project = Project(name='Condor')
servers = project.servers

for server in servers:
    print(server.id)
The servers property returns an EntityList containing Server objects. You can access detailed server properties by iterating through the list.

Floating IPs

Retrieve all floating IPs allocated to a project:
from myos.project import Project

project = Project(name='lsst-drp')
fips = project.fips

for fip in fips:
    print(f"IP: {fip.ip}")
    print(f"ID: {fip.id}")

Project Quotas

Access quota information for a project:
from myos.project import Project

project = Project(name='Condor')
quotas = project.quotas

print(f"Cores: {quotas.cores}")
print(f"RAM: {quotas.ram}")
print(f"Instances: {quotas.instances}")

Project Hierarchy

Projects can have parent-child relationships:
from myos.project import Project

project = Project(name='Cloud-Jupyter-Dev')

if project.parent:
    print(f"Parent project: {project.parent.name}")
else:
    print("This is a root project")

Project Tags

Retrieve tags associated with a project:
from myos.project import Project

project = Project(name='Condor')
tags = project.tags

for tag in tags:
    print(tag)

Complete Project Summary

Here’s a comprehensive example that shows all project resources:
from myos.project import Project

def print_project_summary(project_name):
    """Print a complete summary of project resources"""
    project = Project(name=project_name)
    
    print(f"Project: {project.name}")
    print(f"ID: {project.id}")
    print(f"Tags: {', '.join(project.tags) if project.tags else 'None'}")
    
    # Users
    users = project.users
    print(f"\nUsers ({len(users)}):")
    for user in users:
        print(f"  - {user.email}")
    
    # Servers
    servers = project.servers
    print(f"\nServers ({len(servers)}):")
    for server in servers:
        print(f"  - {server.name} ({server.id})")
    
    # Floating IPs
    fips = project.fips
    print(f"\nFloating IPs ({len(fips)}):")
    for fip in fips:
        print(f"  - {fip.ip}")
    
    # Quotas
    quotas = project.quotas
    print(f"\nQuotas:")
    print(f"  Cores: {quotas.cores}")
    print(f"  RAM: {quotas.ram} MB")
    print(f"  Instances: {quotas.instances}")

# Run the summary
print_project_summary('Condor')

Managing Project Users

Add a user to a project:
from myos.project import Project
from myos.user import User

project = Project(name='Condor')
user = User(name='wup22514', domain_name='stfc')

# Add the user to the project
project.add(user)
This feature requires admin privileges to manage project memberships.

Working with Different Clouds

Specify a custom cloud configuration:
from myos.project import Project
from myos.cloud import Cloud

# Use a different cloud
dev_cloud = Cloud("admin-dev")
project = Project(name='Condor', cloud=dev_cloud)

print(project.name)
print(len(project.servers))

Filtering Project Servers

Combine project queries with EntityList filtering:
from myos.project import Project

project = Project(name='Condor')
servers = project.servers

# Filter for active servers only
active_servers = servers.filter(lambda s: s.status == 'ACTIVE')

print(f"Total servers: {len(servers)}")
print(f"Active servers: {len(active_servers)}")

for server in active_servers:
    print(f"  - {server.name}")
See the Advanced Queries page for more filtering and sorting examples.

Available Properties

PropertyTypeDescription
namestrProject name
idstrProject unique identifier
parentProjectParent project (if any)
tagslistList of project tags
usersEntityListUsers with access to the project
serversEntityListServers running in the project
fipsEntityListFloating IPs allocated to the project
quotasQuotaProject quota information

Next Steps

Build docs developers (and LLMs) love