UoA-eResearch/openface_mass_compare

multiprocessing: Number of processes must be at least 1

Closed this issue · 4 comments

The container keeps crashing with this error:

generating pickle
Traceback (most recent call last):
  File "generate_pickle.py", line 27, in <module>
    p = Pool(processes=PROCESSES, initializer=init)
  File "/usr/lib/python2.7/multiprocessing/__init__.py", line 232, in Pool
    return Pool(processes, initializer, initargs, maxtasksperchild)
  File "/usr/lib/python2.7/multiprocessing/pool.py", line 152, in __init__
    raise ValueError("Number of processes must be at least 1")
ValueError: Number of processes must be at least 1
[2017-02-01 10:14:49 +0000] [9] [INFO] Starting gunicorn 19.6.0
[2017-02-01 10:14:49 +0000] [9] [INFO] Listening at: http://0.0.0.0:8000 (9)
[2017-02-01 10:14:49 +0000] [9] [INFO] Using worker: sync
[2017-02-01 10:14:49 +0000] [14] [INFO] Booting worker with pid: 14
[2017-02-01 10:14:49 +0000] [16] [INFO] Booting worker with pid: 16
[2017-02-01 10:14:49 +0000] [18] [INFO] Booting worker with pid: 18
[2017-02-01 10:14:49 +0000] [20] [INFO] Booting worker with pid: 20
[2017-02-01 10:14:49 +0000] [22] [INFO] Booting worker with pid: 22
[2017-02-01 10:14:49 +0000] [24] [INFO] Booting worker with pid: 24
[2017-02-01 10:14:49 +0000] [26] [INFO] Booting worker with pid: 26
[2017-02-01 10:14:49 +0000] [28] [INFO] Booting worker with pid: 28
[2017-02-01 10:14:57 +0000] [14] [ERROR] Exception in worker process
Traceback (most recent call last):
  File "/usr/local/lib/python2.7/dist-packages/gunicorn/arbiter.py", line 557, in spawn_worker
    worker.init_process()
  File "/usr/local/lib/python2.7/dist-packages/gunicorn/workers/base.py", line 126, in init_process
    self.load_wsgi()
  File "/usr/local/lib/python2.7/dist-packages/gunicorn/workers/base.py", line 136, in load_wsgi
    self.wsgi = self.app.wsgi()
  File "/usr/local/lib/python2.7/dist-packages/gunicorn/app/base.py", line 67, in wsgi
    self.callable = self.load()
  File "/usr/local/lib/python2.7/dist-packages/gunicorn/app/wsgiapp.py", line 65, in load
    return self.load_wsgiapp()
  File "/usr/local/lib/python2.7/dist-packages/gunicorn/app/wsgiapp.py", line 52, in load_wsgiapp
    return util.import_app(self.app_uri)
  File "/usr/local/lib/python2.7/dist-packages/gunicorn/util.py", line 357, in import_app
    __import__(module)
  File "/root/web_server.py", line 32, in <module>
    with open("/root/data/data.pickle") as f:
IOError: [Errno 2] No such file or directory: '/root/data/data.pickle'
[2017-02-01 10:14:57 +0000] [14] [INFO] Worker exiting (pid: 14)
[2017-02-01 10:14:58 +0000] [16] [ERROR] Exception in worker process
Traceback (most recent call last):
  File "/usr/local/lib/python2.7/dist-packages/gunicorn/arbiter.py", line 557, in spawn_worker
    worker.init_process()
  File "/usr/local/lib/python2.7/dist-packages/gunicorn/workers/base.py", line 126, in init_process
    self.load_wsgi()
  File "/usr/local/lib/python2.7/dist-packages/gunicorn/workers/base.py", line 136, in load_wsgi
    self.wsgi = self.app.wsgi()
  File "/usr/local/lib/python2.7/dist-packages/gunicorn/app/base.py", line 67, in wsgi
    self.callable = self.load()
  File "/usr/local/lib/python2.7/dist-packages/gunicorn/app/wsgiapp.py", line 65, in load
    return self.load_wsgiapp()
  File "/usr/local/lib/python2.7/dist-packages/gunicorn/app/wsgiapp.py", line 52, in load_wsgiapp
    return util.import_app(self.app_uri)
  File "/usr/local/lib/python2.7/dist-packages/gunicorn/util.py", line 357, in import_app
    __import__(module)
  File "/root/web_server.py", line 32, in <module>
    with open("/root/data/data.pickle") as f:
IOError: [Errno 2] No such file or directory: '/root/data/data.pickle'
[2017-02-01 10:14:58 +0000] [16] [INFO] Worker exiting (pid: 16)
Traceback (most recent call last):
  File "/usr/local/bin/gunicorn", line 11, in <module>
    sys.exit(run())
  File "/usr/local/lib/python2.7/dist-packages/gunicorn/app/wsgiapp.py", line 74, in run
    WSGIApplication("%(prog)s [OPTIONS] [APP_MODULE]").run()
  File "/usr/local/lib/python2.7/dist-packages/gunicorn/app/base.py", line 192, in run
    super(Application, self).run()
  File "/usr/local/lib/python2.7/dist-packages/gunicorn/app/base.py", line 72, in run
    Arbiter(self).run()
  File "/usr/local/lib/python2.7/dist-packages/gunicorn/arbiter.py", line 218, in run
    self.halt(reason=inst.reason, exit_status=inst.exit_status)
  File "/usr/local/lib/python2.7/dist-packages/gunicorn/arbiter.py", line 331, in halt
    self.stop()
  File "/usr/local/lib/python2.7/dist-packages/gunicorn/arbiter.py", line 381, in stop
    time.sleep(0.1)
  File "/usr/local/lib/python2.7/dist-packages/gunicorn/arbiter.py", line 231, in handle_chld
    self.reap_workers()
  File "/usr/local/lib/python2.7/dist-packages/gunicorn/arbiter.py", line 506, in reap_workers
    raise HaltServer(reason, self.WORKER_BOOT_ERROR)
gunicorn.errors.HaltServer: <HaltServer 'Worker failed to boot.' 3>

Container info:

[
    {
        "Id": "b11964bb9e343d22d239912ff7924d043a856cc326b99c0bec8bd82d1a4c5c2e",
        "Created": "2017-02-01T09:38:24.86630531Z",
        "Path": "/bin/sh",
        "Args": [
            "-c",
            "/root/run.sh"
        ],
        "State": {
            "Status": "exited",
            "Running": false,
            "Paused": false,
            "Restarting": false,
            "OOMKilled": false,
            "Dead": false,
            "Pid": 0,
            "ExitCode": 1,
            "Error": "",
            "StartedAt": "2017-02-01T10:15:09.720998646Z",
            "FinishedAt": "2017-02-01T10:15:20.209644949Z"
        },
        "Image": "sha256:45f15a4cbfa13c0b1086579b54b4a408651c95d9ddc6955627dcb248c0486d4b",
        "ResolvConfPath": "/var/lib/docker/containers/b11964bb9e343d22d239912ff7924d043a856cc326b99c0bec8bd82d1a4c5c2e/resolv.conf",
        "HostnamePath": "/var/lib/docker/containers/b11964bb9e343d22d239912ff7924d043a856cc326b99c0bec8bd82d1a4c5c2e/hostname",
        "HostsPath": "/var/lib/docker/containers/b11964bb9e343d22d239912ff7924d043a856cc326b99c0bec8bd82d1a4c5c2e/hosts",
        "LogPath": "/var/lib/docker/containers/b11964bb9e343d22d239912ff7924d043a856cc326b99c0bec8bd82d1a4c5c2e/b11964bb9e343d22d239912ff7924d043a856cc326b99c0bec8bd82d1a4c5c2e-json.log",
        "Name": "/omc",
        "RestartCount": 2,
        "Driver": "aufs",
        "MountLabel": "",
        "ProcessLabel": "",
        "AppArmorProfile": "",
        "ExecIDs": null,
        "HostConfig": {
            "Binds": [
                "/home/dev/openface:/root/data"
            ],
            "ContainerIDFile": "",
            "LogConfig": {
                "Type": "json-file",
                "Config": {}
            },
            "NetworkMode": "host",
            "PortBindings": {
                "8000/tcp": [
                    {
                        "HostIp": "",
                        "HostPort": "8000"
                    }
                ]
            },
            "RestartPolicy": {
                "Name": "always",
                "MaximumRetryCount": 0
            },
            "AutoRemove": false,
            "VolumeDriver": "",
            "VolumesFrom": null,
            "CapAdd": null,
            "CapDrop": null,
            "Dns": [],
            "DnsOptions": [],
            "DnsSearch": [],
            "ExtraHosts": null,
            "GroupAdd": null,
            "IpcMode": "",
            "Cgroup": "",
            "Links": null,
            "OomScoreAdj": 0,
            "PidMode": "",
            "Privileged": false,
            "PublishAllPorts": false,
            "ReadonlyRootfs": false,
            "SecurityOpt": null,
            "UTSMode": "",
            "UsernsMode": "",
            "ShmSize": 67108864,
            "Runtime": "runc",
            "ConsoleSize": [
                0,
                0
            ],
            "Isolation": "",
            "CpuShares": 0,
            "Memory": 0,
            "NanoCpus": 0,
            "CgroupParent": "",
            "BlkioWeight": 0,
            "BlkioWeightDevice": null,
            "BlkioDeviceReadBps": null,
            "BlkioDeviceWriteBps": null,
            "BlkioDeviceReadIOps": null,
            "BlkioDeviceWriteIOps": null,
            "CpuPeriod": 0,
            "CpuQuota": 0,
            "CpuRealtimePeriod": 0,
            "CpuRealtimeRuntime": 0,
            "CpusetCpus": "",
            "CpusetMems": "",
            "Devices": [],
            "DiskQuota": 0,
            "KernelMemory": 0,
            "MemoryReservation": 0,
            "MemorySwap": 0,
            "MemorySwappiness": -1,
            "OomKillDisable": false,
            "PidsLimit": 0,
            "Ulimits": null,
            "CpuCount": 0,
            "CpuPercent": 0,
            "IOMaximumIOps": 0,
            "IOMaximumBandwidth": 0
        },
        "GraphDriver": {
            "Name": "aufs",
            "Data": null
        },
        "Mounts": [
            {
                "Type": "bind",
                "Source": "/home/dev/openface",
                "Destination": "/root/data",
                "Mode": "",
                "RW": true,
                "Propagation": ""
            }
        ],
        "Config": {
            "Hostname": "dev",
            "Domainname": "",
            "User": "",
            "AttachStdin": false,
            "AttachStdout": false,
            "AttachStderr": false,
            "ExposedPorts": {
                "8000/tcp": {},
                "9000/tcp": {}
            },
            "Tty": false,
            "OpenStdin": false,
            "StdinOnce": false,
            "Env": [
                "PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
            ],
            "Cmd": [
                "/bin/sh",
                "-c",
                "/root/run.sh"
            ],
            "ArgsEscaped": true,
            "Image": "uoacer/openface-mass-compare",
            "Volumes": null,
            "WorkingDir": "",
            "Entrypoint": null,
            "OnBuild": null,
            "Labels": {}
        },
        "NetworkSettings": {
            "Bridge": "",
            "SandboxID": "1442563112f0300eaa0b03f9fc5c5fab07e44255bca1c6894c3d4409beaff7e9",
            "HairpinMode": false,
            "LinkLocalIPv6Address": "",
            "LinkLocalIPv6PrefixLen": 0,
            "Ports": null,
            "SandboxKey": "/var/run/docker/netns/default",
            "SecondaryIPAddresses": null,
            "SecondaryIPv6Addresses": null,
            "EndpointID": "",
            "Gateway": "",
            "GlobalIPv6Address": "",
            "GlobalIPv6PrefixLen": 0,
            "IPAddress": "",
            "IPPrefixLen": 0,
            "IPv6Gateway": "",
            "MacAddress": "",
            "Networks": {
                "host": {
                    "IPAMConfig": null,
                    "Links": null,
                    "Aliases": null,
                    "NetworkID": "dc5c3184582184cdfdd6cf3297e6fb5e781b2f36005488d54960bb2f88e4e39a",
                    "EndpointID": "",
                    "Gateway": "",
                    "IPAddress": "",
                    "IPPrefixLen": 0,
                    "IPv6Gateway": "",
                    "GlobalIPv6Address": "",
                    "GlobalIPv6PrefixLen": 0,
                    "MacAddress": ""
                }
            }
        }
    }
]

Somehow, cpu_count must have evaluated to 0 or 1 for you. "CpuCount": 0, perhaps? Or "CpusetCpus": "". Anyway, give 345cc20 a try and see if that works for you. Depending on the number of images pickle generation may take a while when working single threaded though

Docker build - https://hub.docker.com/r/uoacer/openface-mass-compare/builds/bgiv8f6vgjzrmt6ahi4zutf/

Your commit fixed that issue for me

Yes, it's fixed. Thank you!

I had a similar error:
ValueError: Number of processes must be at least 1

In my case the solution was to revert the configuration of the n_jobs=-1 to its default value (simply by not specifying anything).
Thank you so much neon-nija, your hint about the cpu_count was the key!.