-
Notifications
You must be signed in to change notification settings - Fork 56
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #28 from felix5572/master
refact user api
- Loading branch information
Showing
38 changed files
with
593 additions
and
649 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
import os,shutil,uuid,hashlib | ||
import subprocess as sp | ||
from glob import glob | ||
from dpdispatcher import dlog | ||
|
||
class BaseContext(object): | ||
subclasses_dict = {} | ||
def __init__(self): | ||
raise NotImplementedError('abstract method') | ||
|
||
def __init_subclass__(cls, **kwargs): | ||
super().__init_subclass__(**kwargs) | ||
cls.subclasses_dict[cls.__name__]=cls | ||
|
||
@classmethod | ||
def load_from_dict(cls, context_dict): | ||
context_type = context_dict['context_type'] | ||
print("debug778:context_type", cls.subclasses_dict, context_type) | ||
context_class = cls.subclasses_dict[context_type] | ||
context = context_class.load_from_dict(context_dict) | ||
return context | ||
|
||
def bind_submission(self, submission): | ||
self.submission = submission | ||
|
||
def upload(self, submission): | ||
raise NotImplementedError('abstract method') | ||
|
||
def download(self, | ||
submission, | ||
check_exists = False, | ||
mark_failure = True, | ||
back_error=False): | ||
raise NotImplementedError('abstract method') | ||
|
||
def clean(self): | ||
raise NotImplementedError('abstract method') | ||
|
||
def write_file(self, fname, write_str): | ||
raise NotImplementedError('abstract method') | ||
|
||
def read_file(self, fname): | ||
raise NotImplementedError('abstract method') | ||
|
||
def kill(self, proc): | ||
raise NotImplementedError('abstract method') | ||
|
||
def check_finish(self, proc): | ||
raise NotImplementedError('abstract method') | ||
|
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.