celery.platforms
celery.platforms.pyimplementation()
Return string identifying the current Python implementation.
exception celery.platforms.LockFailed[源代码]
Raised if a pidlock can’t be acquired.
celery.platforms.get_fdmax(default=None)
Return the maximum number of open file descriptors on this system.
class celery.platforms.Pidfile(path)[源代码]
Pidfile
This is the type returned by .
TIP: Use the create_pidlock() function instead, which is more convenient and also removes stale pidfiles (when the process holding the lock is no longer running).
acquire()
Acquire lock.
is_locked()[源代码]
Return true if the pid lock exists.
path = None
read_pid()
Read and return the current pid.
remove()[源代码]
Remove the lock.
-
Remove the lock if the process is not running. (does not respond to signals).
write_pid()
celery.platforms.create_pidlock(pidfile)[源代码]
Create and verify pidfile.
If the pidfile already exists the program exits with an error message, however if the process it refers to is not running anymore, the pidfile is deleted and the program continues.
This function will automatically install an handler to release the lock at exit, you can skip this by calling _create_pidlock() instead.
Example:
celery.platforms.close_open_fds(keep=None)
class celery.platforms.DaemonContext(pidfile=None, workdir=None, umask=None, fake=False, after_chdir=None, \*kwargs*)[源代码]
close(\args*)
open()[源代码]
redirect_to_null(fd)
celery.platforms.detached(logfile=None, pidfile=None, uid=None, gid=None, umask=0, workdir=None, fake=False, \*opts*)[源代码]
Detach the current process in the background (daemonize).
Example:
celery.platforms.parse_uid(uid)
Parse user id.
uid can be an integer (uid) or a string (user name), if a user name the uid is taken from the system user registry.
celery.platforms.parse_gid(gid)[源代码]
Parse group id.
gid can be an integer (gid) or a string (group name), if a group name the gid is taken from the system group registry.
Set active groups from a list of group ids.
celery.platforms.initgroups(uid, gid)
Compat version of os.initgroups() which was first added to Python 2.7.
celery.platforms.setgid(gid)
Version of os.setgid() supporting group names.
celery.platforms.setuid(uid)
Version of os.setuid() supporting usernames.
celery.platforms.maybe_drop_privileges(uid=None, gid=None)
Change process privileges to new user/group.
If UID and GID is specified, the real user/group is changed.
If only UID is specified, the real user is changed, and the group is changed to the users primary group.
If only GID is specified, only the group is changed.
celery.platforms.set_process_title(progname, info=None)[源代码]
Set the ps name for the currently running process.
Only works if setproctitle is installed.
celery.platforms.set_mp_process_title(progname, info=None, hostname=None)
Set the ps name using the multiprocessing process name.
Only works if setproctitle is installed.
celery.platforms.get_errno_name(n)
Get errno for string, e.g. ENOENT.
celery.platforms.ignore_errno(\args, **kwds*)[源代码]
Takes a list of error codes to ignore, which can be either the name of the code, or the code integer itself: