General Purpose Fixie Tools (fixie.tools
)¶
Various helper tools for fixie services.
-
fixie.tools.
default_path
(path, name='', project='', jobid=-1, ext='.h5')[source]¶ Returns a default path name, depending on specified parameters.
-
fixie.tools.
detached_call
(args, stdout=None, stderr=None, stdin=None, env=None, **kwargs)[source]¶ Runs a process and detaches it from its parent (i.e. the current process). In the parent process, this will return the PID of the child. By default, this will return redirect all streams to os.devnull. Additionally, if an environment is not provided, the current fixie environment is passed in. If close_fds is provided, it must be True. All other kwargs are passed through to Popen.
Inspired by detach.call(), Copyright (c) 2014 Ryan Bourgeois.
-
fixie.tools.
fetch
(url, obj)[source]¶ Asynrochously fetches a fixie URL, using the standard fixie interface (POST method, fixie JSON utilties). This fetch functions accepts a Python object, rather than a string for its body.
-
fixie.tools.
flock
(filename, timeout=None, sleepfor=0.1, raise_errors=True)[source]¶ A context manager for locking a file via the filesystem. This yeilds the file descriptor of the lockfile. If raise_errors is False and an exception would have been raised, a file descriptor of zero is yielded instead.
-
fixie.tools.
jobids_from_alias
(user, name='', project='', timeout=None, sleepfor=0.1, raise_errors=True)[source]¶ Obtains a set of job ids from user, name, and project informnation. This looks up information in the the global jobs alias cache. Returns a set of jobids.
-
fixie.tools.
jobids_with_name
(name, project='', timeout=None, sleepfor=0.1, raise_errors=True)[source]¶ Obtains a set of job ids across all users and projects that has a given name. This looks up information in the the global jobs alias cache. Returns a set of jobids.
-
fixie.tools.
next_jobid
(timeout=None, sleepfor=0.1, raise_errors=True)[source]¶ Obtains the next jobid from the $FIXIE_JOBID_FILE and increments the value in $FIXIE_JOBID_FILE. A None value means that the jobid could not be obtained in time.
-
fixie.tools.
register_job_alias
(jobid, user, name='', project='', timeout=None, sleepfor=0.1, raise_errors=True)[source]¶ Registers a job id, user, name, and project in the global jobs alias cache. Returns whether the registration was successful or not.
-
fixie.tools.
verify_user
(user, token, url=None)[source]¶ verifies a user/token pair. This happens either locally (if creds is available) or remotely (if $FIXIE_CREDS_URL was provided).
-
fixie.tools.
verify_user_local
(user, token)[source]¶ Verifies a user via the local (in process) credetialling service.