Detach project in command line

hey cryosparc team,

We have some old users and then left their CS projects as it is. I have to remove those 50 projects from the instance and DB. Is there a way to detach projects using command line ?I dont want to go in to each project and detach them manually.

Also does detaching reduce the database size or does it still fills the space ? What can I do to reduce the DB size after detaching projects and removing users.

Thanks

Hi Team,

Maybe I will explain a bit better. Is there any controls at the user level to detach all projects and delete it from the database ?

I understand this does not reduce the database and I have to run the compact command as explained earlier here

I have about 10 users who left the lab, but they still have large their projects and Jobs occupying database and hard disk. Whats the best way to go about it ?

Thanks for reading.

@Rajan You may detach a hypothetical project P99, then delete associated database records with the cli command sequence

cryosparcm cli "detach_project('P99')"
cryosparcm cli "delete_detached_project('P99')"
1 Like

Thanks @wtempel appreciate it. Is it possible do this on all projects belong to one user ? Maybe I have to extract the list from DB and loop it over ?

Possible? Probably yes, but I caution against excessive automation of this process.
Python constructs like for loops are available in the interactive CLI (cryosparcm icli).
You may also be interested in the "owner_user_id" and "users_with_access" project keys and in the get_email_by_id() cli function.

Thanks. Just one last question. When I do

cryosparcm cli "delete_detached_project('P99')"

This does not delete anything on the hard disk and only delete information from the database ? if the user wants to reattach the project he/she can do simply by browsing to the folder and attach it ?

Thanks @wtempel and very much appreciate your time and effort.

delete_detached_project() deletes data only from the database, not from the project directory.

Yes, assuming the project directory is valid:

  • It must have been successfully detached from the source CryoSPARC instance; data and metadata files inside must not have been modified or removed after detachment.
  • The project directory and its contents must be writeable for the Linux account that runs the destination CryoSPARC instance.