session.md 1.2 KB

Session API

Session is the context to use computing, storage and federation resouraces. At most situation, users should not concern how Session is create. FATE-Flow is responsed to create and init Session when Task launched.

For those who want to use computing, storage and federation api outside FATE-Flow Task, flowing is a short guide.

  1. init Session

    sess = Session()
    sess.as_global()
    
    # flowing is optional, call if needed
        
    # init computing
    sess.init_computing(...)
    
    # init federation
    sess.init_federation(...)
        
    # init federation
    sess.init_storage(...)
    
    1. calling specific api
    computing = sess.computing
    federation = sess.federation
    storage = sess.storage
    
  2. computing api has a shortcut

    from fate_arch.session import computing_session
    computing_session.init(...)
    computing_session.parallelize(...)