Beispiel #1
0
    def make_preexec_fn(self, name):
        """
        Return a function that can be used to set the user id of the spawned process to user with name `name`

        This function can be safely passed to `preexec_fn` of `Popen`
        """
        return set_user_setuid(name)
Beispiel #2
0
    def pull_image(self, image_url):
        """Pull the singularity image to specified image path."""
        image_path = self.get_image_path()
        self.log.info("creating sandbox for notebook")

        try:
            build_cmd = sp.Popen([
                'singularity', 'build', '--force', '--fakeroot', '--sandbox',
                image_path[0], image_url[0]
            ],
                                 preexec_fn=set_user_setuid(self.user.name))
            (output, err) = build_cmd.communicate()
            #res=Client.build(image_url[0],image_path[0],sandbox=True,sudo=False,options=['--fakeroot'],return_result=True)
            self.log.debug(output)
        except:
            self.log.error(res)
        return Unicode(image_path)
Beispiel #3
0
 def make_preexec_fn(self, name):
     """make preexec fn to change uid (if running as root) before job submission"""
     return set_user_setuid(name)
 def make_preexec_fn(self, name):
     """make preexec fn to change uid (if running as root) before job submission"""
     return set_user_setuid(name)
 def make_preexec_fn(self, name):
     """make preexec fn"""
     return set_user_setuid(name)
 def make_preexec_fn(self, name):
     """make preexec fn"""
     return set_user_setuid(name)